blob: c068c886733e3a447f270af012f8c578931d35cc [file] [log] [blame]
Josh Bleecher Snyder7b00c2c2025-07-02 12:24:30 -07001name: Release Build (Nightly)
2
3on:
4 schedule:
5 - cron: "47 9 * * *" # 1:47 AM Pacific Time (9:47 UTC)
6 workflow_dispatch: # Allow manual triggering
7
8permissions:
9 contents: write
10
11jobs:
12 nightly:
Josh Bleecher Snydera50a3bf2025-07-14 19:40:48 +000013 environment: release-build
Josh Bleecher Snyder7b00c2c2025-07-02 12:24:30 -070014 runs-on: ubuntu-latest
15 if: github.ref == 'refs/heads/main'
16 steps:
17 - name: Checkout
18 uses: actions/checkout@v4
19 with:
20 fetch-depth: 0
21
22 - name: Set up Node.js
23 uses: actions/setup-node@v4
24 with:
25 node-version: "20"
26 cache: "npm"
27 cache-dependency-path: "webui/package-lock.json"
28
29 - uses: actions/setup-go@v5
30 with:
31 go-version-file: "${{ inputs.working-directory || '.'}}/go.mod"
32 cache: true
33
Josh Bleecher Snyder5e97dfc2025-07-11 18:14:07 +000034 - name: Install selfupdatectl
35 run: go install github.com/fynelabs/selfupdate/cmd/selfupdatectl@v0.2.1
36
Josh Bleecher Snyder5e97dfc2025-07-11 18:14:07 +000037
Josh Bleecher Snyder7b00c2c2025-07-02 12:24:30 -070038 - name: Check for changes since last tag
39 id: check_changes
40 run: |
41 git fetch --tags --force
42 # find latest nightly tag that looks like nightly/v0.0.N
43 latest_nightly=$(git tag -l "nightly/v0.0.*" --sort=-v:refname | head -n1)
44 if [ -z "$latest_nightly" ]; then
45 echo "has_changes=true" >> $GITHUB_OUTPUT
46 echo "tag=v0.0.1" >> $GITHUB_OUTPUT
47 echo "nightly_tag=nightly/v0.0.1" >> $GITHUB_OUTPUT
48 else
49 echo "Latest nightly tag is $latest_nightly"
50 # Check if there are any new commits since the last nightly tag
51 changes=$(git log $latest_nightly..HEAD --oneline)
52 if [ -z "$changes" ]; then
53 echo "No new changes since last nightly tag, skipping nightly build"
54 echo "has_changes=false" >> $GITHUB_OUTPUT
55 else
56 echo "Changes found since last nightly tag:"
57 echo "$changes"
58 echo "has_changes=true" >> $GITHUB_OUTPUT
59 # Extract N from nightly/v0.0.N and increment
60 version_part="${latest_nightly#nightly/v0.0.}"
61 new_n=$((version_part + 1))
62 new_tag="v0.0.${new_n}"
63 new_nightly_tag="nightly/v0.0.${new_n}"
64 echo "tag=$new_tag" >> $GITHUB_OUTPUT
65 echo "nightly_tag=$new_nightly_tag" >> $GITHUB_OUTPUT
66 fi
67 fi
68
69 - name: Create and push nightly git tag
70 if: steps.check_changes.outputs.has_changes == 'true'
71 env:
72 TAG: ${{ steps.check_changes.outputs.tag }}
73 NIGHTLY_TAG: ${{ steps.check_changes.outputs.nightly_tag }}
74 run: |
75 git config user.name "Sketch Nightly Bot"
76 git config user.email "hello@sketch.dev"
77 git tag -a "$TAG" -m "Nightly build $TAG"
78 git tag -a "$NIGHTLY_TAG" -m "Nightly build tracking tag for $TAG"
79 git push origin "$TAG"
80 git push origin "$NIGHTLY_TAG"
81
82 - name: Run GoReleaser (Nightly)
83 if: steps.check_changes.outputs.has_changes == 'true'
84 uses: goreleaser/goreleaser-action@v4
85 with:
86 version: latest
Josh Bleecher Snyder6ae637a2025-07-09 12:41:56 -070087 # because our builds aren't hermetic, we must build serially
88 args: release --clean --parallelism 1
Josh Bleecher Snyder7b00c2c2025-07-02 12:24:30 -070089 env:
90 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Josh Bleecher Snydera50a3bf2025-07-14 19:40:48 +000091 SELFUPDATE_SIGNING_KEY: ${{ secrets.SELFUPDATE_ED25519_SIGNING_KEY }}
Josh Bleecher Snyderb58bbf32025-07-16 18:33:34 +000092 HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
Josh Bleecher Snyder7b00c2c2025-07-02 12:24:30 -070093
David Crawshawb80db9c2025-07-12 01:20:36 +000094
Josh Bleecher Snyder5e97dfc2025-07-11 18:14:07 +000095
Josh Bleecher Snydera50a3bf2025-07-14 19:40:48 +000096