build-pre-release #183
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Daily build and release workflow. | |
| name: build-pre-release | |
| on: | |
| # Runs daily at UTC midnight to minimize risk of overstepping | |
| # manual builds of same date. | |
| schedule: | |
| - cron: "0 0 * * *" | |
| # Allow manual activations. | |
| workflow_dispatch: | |
| permissions: | |
| # Allow release creation | |
| contents: write | |
| env: | |
| # -- Set the version of the upstream release. | |
| # -- See list at https://github.com/chipsalliance/verible/releases | |
| VERIBLE_RELEASE_TAG: "v0.0-3862-g936dfb1d" | |
| # -- These are set later | |
| RELEASE_TAG: "" | |
| PACKAGE_TAG: "" | |
| jobs: | |
| # -- Build packages for all supported architectures and | |
| # -- export them in a release. | |
| build-pre-release: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| # Check out the this repo in the workflow work directory. | |
| - name: Checkout this repo | |
| uses: actions/checkout@v4 | |
| - name: Get release and package tags | |
| uses: fpgawars/apio-workflows/.github/actions/get-release-and-package-tags@main | |
| with: | |
| release-tag-var: RELEASE_TAG | |
| package-tag-var: PACKAGE_TAG | |
| # - name: Get repository commit | |
| # uses: fpgawars/apio-workflows/.github/actions/get-repo-commit@main | |
| # with: | |
| # repo-dir: . | |
| # env-var-name: RELEASE_COMMIT | |
| - name: Get repository commit | |
| uses: fpgawars/apio-workflows/.github/actions/get-repo-info@main | |
| with: | |
| repo-dir: . | |
| commit-var: RELEASE_COMMIT | |
| - name: Create the build-info.json file | |
| run: | | |
| cat > build-info.json <<EOF | |
| { | |
| "package-name": "verible", | |
| "description" : "Verible tools for Apio", | |
| "release-tag": "$RELEASE_TAG", | |
| "verible-release-tag": "$VERIBLE_RELEASE_TAG", | |
| "build-repo": "${{github.repository}}", | |
| "build-workflow": "${{ github.workflow }}", | |
| "workflow-run-id": "${{github.run_id}}", | |
| "workflow-run-number": "${{github.run_number}}", | |
| "build-time": "$(date +'%Y-%m-%d %H:%M:%S %Z')", | |
| "commit": "$RELEASE_COMMIT" | |
| } | |
| EOF | |
| cat -n build-info.json | |
| - name: Format build info json file in-place | |
| uses: fpgawars/apio-workflows/.github/actions/format-json-file@main | |
| with: | |
| json-file: build-info.json | |
| - name: Make the build info file read only | |
| run: | | |
| chmod 444 build-info.json | |
| - name: Build package [darwin-arm64] | |
| run: | | |
| python .github/workflows/build.py \ | |
| --platform-id darwin-arm64 \ | |
| --build-info-json build-info.json | |
| - name: Build package [darwin-x86-64] | |
| run: | | |
| python .github/workflows/build.py \ | |
| --platform-id darwin-x86-64 \ | |
| --build-info-json build-info.json | |
| - name: Build package [linux-x86-64] | |
| run: | | |
| python .github/workflows/build.py \ | |
| --platform-id linux-x86-64 \ | |
| --build-info-json build-info.json | |
| - name: Build package [linux-aarch64] | |
| run: | | |
| python .github/workflows/build.py \ | |
| --platform-id linux-aarch64 \ | |
| --build-info-json build-info.json | |
| - name: Build package [windows-amd64] | |
| run: | | |
| python .github/workflows/build.py \ | |
| --platform-id windows-amd64 \ | |
| --build-info-json build-info.json | |
| - name: List packages | |
| run: | | |
| ls -al _packages/* | |
| - name: Convert json build info to text | |
| uses: fpgawars/apio-workflows/.github/actions/json-to-text@main | |
| with: | |
| input-json: build-info.json | |
| output-text: build-info.txt | |
| # Summary for the workflow run page. | |
| - name: Prepare workflow run summary | |
| run: | | |
| cat > RUN-SUMMARY.txt <<EOF | |
| Build info: | |
| \`\`\` | |
| $(cat build-info.txt) | |
| \`\`\` | |
| - [Cutoff commit](https://github.com/${{ github.repository }}/commit/${RELEASE_COMMIT}) | |
| - [Generated pre-release](https://github.com/${{ github.repository }}/releases/tag/${RELEASE_TAG}) | |
| - [Included Verible release](https://github.com/chipsalliance/verible/releases/tag/${VERIBLE_RELEASE_TAG}) | |
| EOF | |
| ls -al | |
| cat -n RUN-SUMMARY.txt | |
| - name: Post workflow run summary | |
| run: | | |
| cat RUN-SUMMARY.txt >> $GITHUB_STEP_SUMMARY | |
| - name: Prepare release text | |
| run: | | |
| cat > RELEASE-BODY.txt <<EOF | |
| > ### Pre-release note | |
| > | |
| > This daily release was created as a pre-release and | |
| > will be deleted after 5 days unless if it's marked as a stable release. To make | |
| > this a stable release, do the following: | |
| > * Open the release for editing. | |
| > * Turn off the \`Set as a pre-release\` checkbox below. | |
| > * (optional) Turn on the \`Set as the latest release\` checkbox. | |
| > * Remove this pre-release note. | |
| > * (optional) Add release notes. | |
| > * Click \`Update Release\` button to save your changes. | |
| ### Build info | |
| \`\`\` | |
| $(cat build-info.txt) | |
| \`\`\` | |
| EOF | |
| cat -n RELEASE-BODY.txt | |
| - name: Scan the package for viruses | |
| uses: fpgawars/apio-workflows/.github/actions/scan-files-for-viruses@main | |
| with: | |
| file-patterns: | | |
| _packages/apio-verible-*.tgz | |
| - name: Cleanup old pre-releases | |
| uses: fpgawars/apio-workflows/.github/actions/cleanup-old-prereleases@main | |
| - name: Ensure no conflicting release | |
| uses: fpgawars/apio-workflows/.github/actions/ensure-no-conflicting-release@main | |
| with: | |
| release-tag: ${{ env.RELEASE_TAG }} | |
| - name: Create GitHub pre-release | |
| uses: fpgawars/apio-workflows/.github/actions/create-pre-release@main | |
| with: | |
| release_tag: ${{ env.RELEASE_TAG }} | |
| body_path: RELEASE-BODY.txt | |
| # We intensionally list explicitly all the expected files. | |
| files: | | |
| _packages/apio-verible-darwin-arm64-${{env.PACKAGE_TAG}}.tgz | |
| _packages/apio-verible-darwin-x86-64-${{env.PACKAGE_TAG}}.tgz | |
| _packages/apio-verible-linux-x86-64-${{env.PACKAGE_TAG}}.tgz | |
| _packages/apio-verible-linux-aarch64-${{env.PACKAGE_TAG}}.tgz | |
| _packages/apio-verible-windows-amd64-${{env.PACKAGE_TAG}}.tgz |