|
| 1 | +name: Create the nightly release |
| 2 | +on: |
| 3 | + schedule: |
| 4 | + # Take into account lut99's sleep schedule |
| 5 | + - cron: 0 4 * * * |
| 6 | + |
| 7 | + # Manual mechanism to bump the nightly in case of a issue with the one from last night |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + ref: |
| 11 | + description: "What ref to use for the nighly release" |
| 12 | + default: main |
| 13 | + required: false |
| 14 | + type: string |
| 15 | + force: |
| 16 | + description: "Create a new release, regardless if the current nightly tag points to the same commit as ref" |
| 17 | + default: false |
| 18 | + required: false |
| 19 | + type: boolean |
| 20 | + |
| 21 | +concurrency: |
| 22 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 23 | + cancel-in-progress: true |
| 24 | + |
| 25 | +env: |
| 26 | + CARGO_INCREMENTAL: 0 |
| 27 | + CARGO_TERM_COLOR: always |
| 28 | + GH_TOKEN: ${{ github.token }} |
| 29 | + |
| 30 | +jobs: |
| 31 | + tag: |
| 32 | + name: "Add nightly tag" |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + - name: Checkout |
| 36 | + uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + ref: ${{ inputs.ref || 'main' }} |
| 39 | + fetch-tags: true |
| 40 | + - name: Check if there is anything to be done |
| 41 | + if: ${{ !inputs.force }} |
| 42 | + run: | |
| 43 | + git rev-parse HEAD || true |
| 44 | + git rev-parse 'nightly^{commit}' || true |
| 45 | + [[ $(git rev-parse HEAD) != $(git rev-parse 'nightly^{commit}') ]] |
| 46 | + - name: Tag the latest commit |
| 47 | + run: | |
| 48 | + git config user.name "Brane" |
| 49 | + git config user.email "brane@nonexistentemail.com" |
| 50 | + git tag --force nightly |
| 51 | + git push --force --tags nightly |
| 52 | +
|
| 53 | + build: |
| 54 | + name: "Build & package" |
| 55 | + needs: tag |
| 56 | + strategy: |
| 57 | + fail-fast: false |
| 58 | + matrix: |
| 59 | + include: |
| 60 | + - runner: ubuntu-latest |
| 61 | + os: linux |
| 62 | + arch: x86_64 |
| 63 | + - runner: macos-latest |
| 64 | + os: macos |
| 65 | + arch: aarch64 |
| 66 | + - runner: windows-latest |
| 67 | + os: windows |
| 68 | + arch: x86_64 |
| 69 | + - runner: ubuntu-24.04-arm |
| 70 | + os: linux |
| 71 | + arch: aarch64 |
| 72 | + - runner: macos-13 |
| 73 | + os: macos |
| 74 | + arch: x86_64 |
| 75 | + |
| 76 | + runs-on: ${{ matrix.runner }} |
| 77 | + steps: |
| 78 | + - name: Checkout |
| 79 | + uses: actions/checkout@v4 |
| 80 | + with: |
| 81 | + ref: nightly |
| 82 | + fetch-tags: true |
| 83 | + - name: Set up Docker Buildx |
| 84 | + if: ${{ matrix.os == 'linux' }} |
| 85 | + uses: docker/setup-buildx-action@v3 |
| 86 | + - name: Install Go |
| 87 | + if: ${{ matrix.os == 'macos' }} |
| 88 | + uses: actions/setup-go@v5 |
| 89 | + with: |
| 90 | + go-version: '^1.23.4' |
| 91 | + - name: Build xtask |
| 92 | + run: | |
| 93 | + cargo build --release --no-default-features --package xtask -F ci |
| 94 | + - name: Update package version in Cargo.toml |
| 95 | + run: | |
| 96 | + cargo run --release --no-default-features --package xtask -F ci set-version -p nightly -m '$git_hash$git_dirty' |
| 97 | + - name: Build |
| 98 | + run: | |
| 99 | + cargo run --release --no-default-features --package xtask -F ci build all |
| 100 | + - name: Package |
| 101 | + run: | |
| 102 | + cargo run --release --no-default-features --package xtask -F ci package github |
| 103 | + - name: Upload |
| 104 | + uses: actions/upload-artifact@v4 |
| 105 | + with: |
| 106 | + name: build-${{ matrix.os }}-${{ matrix.arch }}-nightly |
| 107 | + path: | |
| 108 | + target/package/release/* |
| 109 | + if-no-files-found: error |
| 110 | + retention-days: 1 |
| 111 | + |
| 112 | + release: |
| 113 | + name: "Release artifacts to GitHub" |
| 114 | + needs: build |
| 115 | + runs-on: ubuntu-latest |
| 116 | + steps: |
| 117 | + - name: Download artifacts |
| 118 | + uses: actions/download-artifact@v4 |
| 119 | + # without further specification, downloads all artifacts from the run |
| 120 | + with: |
| 121 | + path: release |
| 122 | + merge-multiple: true |
| 123 | + - name: Delete previous nightly release |
| 124 | + run: gh -R $GITHUB_REPOSITORY release delete nightly |
| 125 | + - name: Release |
| 126 | + uses: softprops/action-gh-release@v2 |
| 127 | + with: |
| 128 | + files: | |
| 129 | + release/* |
| 130 | + fail_on_unmatched_files: true |
| 131 | + tag_name: nightly |
| 132 | + name: Nightly |
| 133 | + prerelease: true |
| 134 | + body: This is the nightly (daily) release of Brane. This build can occasionally break. Do not use in production. |
| 135 | + draft: false |
| 136 | + make_latest: false |
0 commit comments