Create the nightly release #242
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
| name: Create the nightly release | |
| on: | |
| schedule: | |
| # Take into account lut99's sleep schedule | |
| - cron: 0 4 * * * | |
| # Manual mechanism to bump the nightly in case of a issue with the one from last night | |
| workflow_dispatch: | |
| inputs: | |
| ref: | |
| description: "What ref to use for the nighly release" | |
| default: main | |
| required: false | |
| type: string | |
| force: | |
| description: "Create a new release, regardless if the current nightly tag points to the same commit as ref" | |
| default: false | |
| required: false | |
| type: boolean | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_TERM_COLOR: always | |
| GH_TOKEN: ${{ github.token }} | |
| jobs: | |
| tag: | |
| name: "Add nightly tag" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.ref || 'main' }} | |
| fetch-tags: true | |
| - name: Check if there is anything to be done | |
| if: ${{ !inputs.force }} | |
| run: | | |
| git rev-parse HEAD || true | |
| git rev-parse 'nightly^{commit}' || true | |
| [[ $(git rev-parse HEAD) != $(git rev-parse 'nightly^{commit}') ]] | |
| - name: Tag the latest commit | |
| run: | | |
| git config user.name "Brane" | |
| git config user.email "brane@nonexistentemail.com" | |
| git tag --force nightly | |
| git push --force --tags origin nightly | |
| build: | |
| name: "Build & package" | |
| needs: tag | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: ubuntu-latest | |
| os: linux | |
| arch: x86_64 | |
| - runner: macos-latest | |
| os: macos | |
| arch: aarch64 | |
| - runner: windows-latest | |
| os: windows | |
| arch: x86_64 | |
| - runner: ubuntu-24.04-arm | |
| os: linux | |
| arch: aarch64 | |
| - runner: macos-13 | |
| os: macos | |
| arch: x86_64 | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: nightly | |
| fetch-tags: true | |
| - name: Set up Docker Buildx | |
| if: ${{ matrix.os == 'linux' }} | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Install Go | |
| if: ${{ matrix.os == 'macos' }} | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '^1.23.4' | |
| - name: Build xtask | |
| run: | | |
| cargo build --release --no-default-features --package xtask -F ci | |
| - name: Update package version in Cargo.toml | |
| run: | | |
| cargo run --release --no-default-features --package xtask -F ci set-version -p nightly -m '$git_hash$git_dirty' | |
| - name: Build | |
| run: | | |
| cargo run --release --no-default-features --package xtask -F ci build all | |
| - name: Package | |
| run: | | |
| cargo run --release --no-default-features --package xtask -F ci package github | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-${{ matrix.os }}-${{ matrix.arch }}-nightly | |
| path: | | |
| target/package/release/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| release: | |
| name: "Release artifacts to GitHub" | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| # without further specification, downloads all artifacts from the run | |
| with: | |
| path: release | |
| merge-multiple: true | |
| - name: Delete previous nightly release | |
| run: gh -R "$GITHUB_REPOSITORY" release delete nightly | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| release/* | |
| fail_on_unmatched_files: true | |
| tag_name: nightly | |
| name: Nightly | |
| prerelease: true | |
| body: This is the nightly (daily) release of Brane. This build can occasionally break. Do not use in production. | |
| draft: false | |
| make_latest: false |