|
| 1 | +--- |
| 2 | +name: nightly |
| 3 | + |
| 4 | +on: |
| 5 | + schedule: |
| 6 | + - cron: "0 6 * * *" # 6am UTC / midnight ET |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + nightly: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + |
| 21 | + - name: Check for new commits |
| 22 | + id: check |
| 23 | + run: | |
| 24 | + git fetch origin nightly 2>/dev/null || true |
| 25 | + if git rev-parse nightly >/dev/null 2>&1 && [ "$(git rev-parse nightly)" = "$(git rev-parse HEAD)" ]; then |
| 26 | + echo "skip=true" >> $GITHUB_OUTPUT |
| 27 | + else |
| 28 | + echo "skip=false" >> $GITHUB_OUTPUT |
| 29 | + fi |
| 30 | +
|
| 31 | + - name: Set up Go |
| 32 | + if: steps.check.outputs.skip != 'true' |
| 33 | + uses: actions/setup-go@v4 |
| 34 | + with: |
| 35 | + go-version: "1.25" |
| 36 | + |
| 37 | + - name: Run GoReleaser (snapshot) |
| 38 | + if: steps.check.outputs.skip != 'true' |
| 39 | + uses: goreleaser/goreleaser-action@v5 |
| 40 | + with: |
| 41 | + version: latest |
| 42 | + args: release --clean --snapshot |
| 43 | + env: |
| 44 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + SENTRY_DSN: ${{ secrets.SENTRY_DSN }} |
| 46 | + |
| 47 | + - name: Set build date |
| 48 | + if: steps.check.outputs.skip != 'true' |
| 49 | + id: date |
| 50 | + run: echo "date=$(date -u +%Y-%m-%d)" >> $GITHUB_OUTPUT |
| 51 | + |
| 52 | + - name: Move nightly tag to HEAD |
| 53 | + if: steps.check.outputs.skip != 'true' |
| 54 | + run: | |
| 55 | + git config user.name "github-actions[bot]" |
| 56 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 57 | + git tag -f nightly |
| 58 | + git push -f origin nightly |
| 59 | +
|
| 60 | + - name: Publish nightly pre-release |
| 61 | + if: steps.check.outputs.skip != 'true' |
| 62 | + uses: softprops/action-gh-release@v2 |
| 63 | + with: |
| 64 | + tag_name: nightly |
| 65 | + name: "Nightly Build (${{ steps.date.outputs.date }})" |
| 66 | + prerelease: true |
| 67 | + make_latest: false |
| 68 | + body: | |
| 69 | + Automated nightly build from `main`. **Not for production use.** |
| 70 | +
|
| 71 | + Commit: ${{ github.sha }} |
| 72 | + files: | |
| 73 | + dist/*.tar.gz |
| 74 | + dist/*.zip |
| 75 | + env: |
| 76 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments