Nightly Build & Release #124
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: Nightly Build & Release | |
| on: | |
| schedule: | |
| # Daily at 06:00 AM UTC | |
| - cron: '0 6 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| env: | |
| DAGGER_VERSION: "0.20.8" | |
| jobs: | |
| check: | |
| runs-on: depot-ubuntu-24.04 | |
| outputs: | |
| should_build: ${{ steps.check.outputs.should_build }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for new commits | |
| id: check | |
| run: | | |
| LAST_SHA=$( | |
| gh run list \ | |
| --workflow nightly.yaml \ | |
| --status success \ | |
| --limit 1 \ | |
| --json headSha -q '.[0].headSha' || echo "" | |
| ) | |
| echo "Last successful build SHA: ${LAST_SHA:-none}" | |
| echo "Current SHA: ${{ github.sha }}" | |
| if [ "$LAST_SHA" = "${{ github.sha }}" ]; then | |
| echo "should_build=false" >> $GITHUB_OUTPUT | |
| echo "No new commits since last nightly!" | |
| else | |
| echo "should_build=true" >> $GITHUB_OUTPUT | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| move-nightly-tag: | |
| name: Move up Nightly tag | |
| needs: check | |
| if: needs.check.outputs.should_build == 'true' | |
| runs-on: depot-ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Move nightly tag up to HEAD | |
| run: | | |
| git tag -f nightly | |
| git push -f origin nightly | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-linux: | |
| name: Build Linux | |
| needs: [check, move-nightly-tag] | |
| if: needs.check.outputs.should_build == 'true' | |
| runs-on: depot-ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Dagger | |
| uses: dagger/dagger-for-github@v8.2.0 | |
| with: | |
| version: ${{ env.DAGGER_VERSION }} | |
| - name: Build and upload Linux nightly artifacts to bucket | |
| run: | | |
| dagger call \ | |
| release-nightly \ | |
| --commit="${{ github.sha }}" \ | |
| --post-hog-public-key="${{ secrets.POSTHOG_API_KEY }}" \ | |
| --endpoint=env://BUCKET_ENDPOINT \ | |
| --bucket=env://BUCKET_NAME \ | |
| --access-key-id=env://BUCKET_ACCESS_KEY_ID \ | |
| --secret-access-key=env://BUCKET_SECRET_ACCESS_KEY \ | |
| export \ | |
| --path=./build | |
| env: | |
| BUCKET_ENDPOINT: ${{ secrets.BUCKET_ENDPOINT }} | |
| BUCKET_NAME: ${{ secrets.BUCKET_NAME }} | |
| BUCKET_ACCESS_KEY_ID: ${{ secrets.BUCKET_ACCESS_KEY_ID }} | |
| BUCKET_SECRET_ACCESS_KEY: ${{ secrets.BUCKET_SECRET_ACCESS_KEY }} | |
| DAGGER_CLOUD_TOKEN: ${{ secrets.DAGGER_CLOUD_TOKEN }} | |
| - name: Upload linux artifacts for gh release | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-nightly | |
| path: build/ | |
| retention-days: 1 | |
| build-darwin: | |
| name: Build macOS arm64 | |
| needs: [check, move-nightly-tag] | |
| if: needs.check.outputs.should_build == 'true' | |
| runs-on: macos-15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Build and codesign darwin/arm64 binary | |
| run: make apple-build VERSION=nightly COMMIT="${{ github.sha }}" POSTHOG_API_KEY="${{ secrets.POSTHOG_API_KEY }}" | |
| - name: Generate checksum | |
| run: shasum -a 256 build/darwin/arm64/mb > build/darwin/arm64/mb.sha256 | |
| - name: Upload darwin artifacts for bucket upload and gh release | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: darwin-nightly | |
| path: build/ | |
| retention-days: 1 | |
| upload: | |
| name: Upload Nightly Artifacts | |
| needs: [build-linux, build-darwin] | |
| runs-on: depot-ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download linux artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-nightly | |
| path: build/ | |
| - name: Download darwin artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: darwin-nightly | |
| path: build/ | |
| - name: Install Dagger | |
| uses: dagger/dagger-for-github@v8.2.0 | |
| with: | |
| version: ${{ env.DAGGER_VERSION }} | |
| - name: Upload darwin artifacts to bucket | |
| run: | | |
| dagger call \ | |
| upload-darwin-artifacts \ | |
| --access-key-id=env://BUCKET_ACCESS_KEY_ID \ | |
| --binary=./build/darwin/arm64/mb \ | |
| --bucket=env://BUCKET_NAME \ | |
| --checksum=./build/darwin/arm64/mb.sha256 \ | |
| --endpoint=env://BUCKET_ENDPOINT \ | |
| --prefixes="nightly/darwin/arm64" \ | |
| --secret-access-key=env://BUCKET_SECRET_ACCESS_KEY | |
| env: | |
| BUCKET_ENDPOINT: ${{ secrets.BUCKET_ENDPOINT }} | |
| BUCKET_NAME: ${{ secrets.BUCKET_NAME }} | |
| BUCKET_ACCESS_KEY_ID: ${{ secrets.BUCKET_ACCESS_KEY_ID }} | |
| BUCKET_SECRET_ACCESS_KEY: ${{ secrets.BUCKET_SECRET_ACCESS_KEY }} | |
| DAGGER_CLOUD_TOKEN: ${{ secrets.DAGGER_CLOUD_TOKEN }} | |
| - name: Update nightly GitHub release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: nightly | |
| name: "Nightly Build & Release" | |
| body: | | |
| **Automated nightly build** | |
| This is an unstable development build off the tip of `main`. | |
| Commit: ${{ github.sha }} | |
| **Download:** | |
| - Linux AMD64: `curl -LO https://masterblaster.stereos.ai/nightly/linux/amd64/mb` | |
| - Linux ARM64: `curl -LO https://masterblaster.stereos.ai/nightly/linux/arm64/mb` | |
| - macOS ARM64: `curl -LO https://masterblaster.stereos.ai/nightly/darwin/arm64/mb` | |
| prerelease: true | |
| allowUpdates: true | |
| removeArtifacts: true | |
| makeLatest: false | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload all artifacts to GitHub release | |
| run: | | |
| dagger call -m github.com/papercomputeco/daggerverse/ghrelease \ | |
| --token=env:GH_TOKEN \ | |
| with-repo --repo="${{ github.repository }}" \ | |
| with-assets --assets=./build \ | |
| with-flatten \ | |
| with-tag --tag "nightly" \ | |
| upload | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| DAGGER_CLOUD_TOKEN: ${{ secrets.DAGGER_CLOUD_TOKEN }} |