Skip to content

Commit 94a5905

Browse files
feat(nightly): build nightlies from main shas (block#4888)
Co-authored-by: Finn Herzfeld <[email protected]>
1 parent cc5e4a5 commit 94a5905

File tree

1 file changed

+24
-29
lines changed

1 file changed

+24
-29
lines changed

.github/workflows/nightly.yml

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# This workflow is for nightly releases, automatically triggered at midnight US Eastern
1+
# A release from main. Automatically triggered at midnight US Eastern.
2+
23
name: Nightly Build
34

45
on:
@@ -12,6 +13,7 @@ on:
1213
required: false
1314
default: 'main'
1415

16+
1517
concurrency:
1618
group: ${{ github.workflow }}-${{ github.ref }}
1719
cancel-in-progress: true
@@ -22,25 +24,30 @@ jobs:
2224
runs-on: ubuntu-latest
2325
outputs:
2426
version: ${{ steps.set-version.outputs.version }}
27+
commit_sha: ${{ steps.get-commit.outputs.commit_sha }}
2528
steps:
2629
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
2730
with:
28-
ref: ${{ github.event.inputs.branch || github.ref }}
31+
ref: main # Ensure we're building from latest main
32+
fetch-depth: 0
33+
34+
- name: Get commit info
35+
id: get-commit
36+
run: |
37+
echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
38+
echo "Building from commit: $(git rev-parse HEAD)"
39+
echo "Latest commit: $(git log -1 --oneline)"
2940
3041
- name: Generate a nightly version
3142
id: set-version
3243
run: |
44+
# Extract the version from Cargo.toml and add nightly tag with date and short commit
3345
VERSION=$(grep '^version\s*=' Cargo.toml | head -n 1 | cut -d\" -f2)
3446
DATE=$(date -u +%Y%m%d)
35-
VERSION="${VERSION}-nightly.${DATE}"
36-
37-
# validate
38-
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+-nightly\.[0-9]{8}$ ]]; then
39-
echo "Error: Invalid version format: $VERSION"
40-
exit 1
41-
fi
42-
47+
SHORT_SHA=$(git rev-parse --short HEAD)
48+
VERSION="${VERSION}-nightly.${DATE}.${SHORT_SHA}"
4349
echo "version=$VERSION" >> $GITHUB_OUTPUT
50+
echo "Generated version: $VERSION"
4451
4552
build-cli:
4653
needs: [prepare-version]
@@ -67,7 +74,9 @@ jobs:
6774
contents: read
6875
with:
6976
version: ${{ needs.prepare-version.outputs.version }}
70-
signing: false
77+
signing: true
78+
secrets:
79+
OSX_CODESIGN_ROLE: ${{ secrets.OSX_CODESIGN_ROLE }}
7180

7281
bundle-desktop-linux:
7382
needs: [prepare-version]
@@ -80,32 +89,19 @@ jobs:
8089
uses: ./.github/workflows/bundle-desktop-windows.yml
8190
with:
8291
version: ${{ needs.prepare-version.outputs.version }}
83-
signing: false
92+
signing: true
93+
secrets:
94+
WINDOW_SIGNING_ROLE: ${{ secrets.WINDOW_SIGNING_ROLE }}
95+
WINDOW_SIGNING_ROLE_TAG: ${{ secrets.WINDOW_SIGNING_ROLE_TAG }}
8496

8597
release:
8698
name: Release
8799
runs-on: ubuntu-latest
88100
needs: [prepare-version, build-cli, install-script, bundle-desktop, bundle-desktop-linux, bundle-desktop-windows]
89101
permissions:
90102
contents: write
91-
actions: read
92103
steps:
93104
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
94-
with:
95-
ref: ${{ github.event.inputs.branch || github.ref }}
96-
fetch-depth: 0 # Fetch all history for proper tagging
97-
98-
- name: Create tag
99-
run: |
100-
TAG="${{ needs.prepare-version.outputs.version }}"
101-
102-
echo "Creating tag: $TAG"
103-
git config user.name "github-actions[bot]"
104-
git config user.email "github-actions[bot]@users.noreply.github.com"
105-
106-
git tag -a "$TAG" -m "Nightly release $TAG - SHA: ${{ github.sha }} - Run: ${{ github.run_number }}"
107-
git push origin "$TAG"
108-
echo "Tag $TAG created successfully"
109105

110106
- name: Download all artifacts
111107
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # pin@v4
@@ -129,4 +125,3 @@ jobs:
129125
omitBody: true
130126
prerelease: true
131127
makeLatest: false
132-
omitPrereleaseDuringUpdate: true

0 commit comments

Comments
 (0)