build-pre-release #40
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: | |
| # The yosys oss-cad-suite to pick up. yyyy-mm-dd. | |
| # See https://github.com/YosysHQ/oss-cad-suite-build/releases | |
| # | |
| YOSYS_RELEASE_TAG: 2026-02-02 | |
| # 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: | |
| - 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 | |
| # Required by the build script to extracting windows .exe. | |
| - name: Install p7zip (7z command) | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y p7zip-full | |
| - name: Checkout this repo | |
| uses: actions/checkout@v4 | |
| # - 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": "oss-cad-suite", | |
| "description" : "Yosys tools for Apio", | |
| "release-tag": "$RELEASE_TAG", | |
| "yosys-release-tag": "$YOSYS_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: Scan the package for viruses | |
| uses: fpgawars/apio-workflows/.github/actions/scan-files-for-viruses@main | |
| with: | |
| file-patterns: | | |
| _packages/apio-oss-cad-suite-*.tgz | |
| - 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 Yosys release](https://github.com/YosysHQ/oss-cad-suite-build/releases/tag/${YOSYS_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: 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-oss-cad-suite-darwin-arm64-${{env.PACKAGE_TAG}}.tgz | |
| _packages/apio-oss-cad-suite-darwin-x86-64-${{env.PACKAGE_TAG}}.tgz | |
| _packages/apio-oss-cad-suite-linux-x86-64-${{env.PACKAGE_TAG}}.tgz | |
| _packages/apio-oss-cad-suite-linux-aarch64-${{env.PACKAGE_TAG}}.tgz | |
| _packages/apio-oss-cad-suite-windows-amd64-${{env.PACKAGE_TAG}}.tgz |