-
Notifications
You must be signed in to change notification settings - Fork 279
feat: add nightly releases via GoReleaser and Homebrew tap #825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,46 @@ | ||||||
| name: Nightly Release | ||||||
|
|
||||||
| on: | ||||||
| schedule: | ||||||
| - cron: "0 6 * * *" # 06:00 UTC daily | ||||||
| workflow_dispatch: | ||||||
|
|
||||||
| permissions: | ||||||
| contents: write | ||||||
|
|
||||||
| jobs: | ||||||
| create-nightly-tag: | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - uses: actions/checkout@v6 | ||||||
| with: | ||||||
| fetch-depth: 0 | ||||||
|
|
||||||
| - name: Create nightly tag if new commits exist | ||||||
| run: | | ||||||
| LAST_NIGHTLY=$(git tag -l 'v*-nightly.*' --sort=-v:refname | head -1) | ||||||
| if [ -n "$LAST_NIGHTLY" ]; then | ||||||
| COMMITS=$(git rev-list "${LAST_NIGHTLY}..HEAD" --count) | ||||||
| if [ "$COMMITS" -eq 0 ]; then | ||||||
| echo "No new commits since ${LAST_NIGHTLY}, skipping." | ||||||
| exit 0 | ||||||
| fi | ||||||
| fi | ||||||
|
|
||||||
| LATEST_STABLE=$(git describe --tags --abbrev=0 --match 'v[0-9]*' --exclude '*-*' 2>/dev/null) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if we want current stable or current stable +1 patch. Because:
So if the current release is
|
||||||
| if [ -z "$LATEST_STABLE" ]; then | ||||||
| echo "::error::No stable version tag found" | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
| DATE=$(date -u +%Y%m%d) | ||||||
| TAG="${LATEST_STABLE}-nightly.${DATE}" | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shall we also add the short hash to it?
Suggested change
|
||||||
|
|
||||||
| if git rev-parse "${TAG}" >/dev/null 2>&1; then | ||||||
| echo "Tag ${TAG} already exists, skipping." | ||||||
| exit 0 | ||||||
| fi | ||||||
|
|
||||||
| echo "Creating nightly tag: ${TAG}" | ||||||
| git tag "${TAG}" | ||||||
| git push origin "${TAG}" | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nightly tag push won't trigger release workflowHigh Severity The nightly workflow pushes tags using the default Additional Locations (1) |
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -30,13 +30,27 @@ jobs: | |||||
| homebrew-tap | ||||||
| scoop-bucket | ||||||
|
|
||||||
| - name: Extract release notes from CHANGELOG.md | ||||||
| - name: Extract release notes | ||||||
| run: | | ||||||
| VERSION="${GITHUB_REF_NAME#v}" | ||||||
| awk -v ver="$VERSION" 'BEGIN{header="^## \\[" ver "\\]"} $0 ~ header{found=1; next} /^## \[/{if(found) exit} found{print}' CHANGELOG.md > "$RUNNER_TEMP/release_notes.md" | ||||||
| if [ ! -s "$RUNNER_TEMP/release_notes.md" ]; then | ||||||
| echo "::error::No changelog entry found for version ${VERSION} in CHANGELOG.md" | ||||||
| exit 1 | ||||||
|
|
||||||
| if [[ "$VERSION" == *-* ]]; then | ||||||
| # Prerelease (nightly): generate notes from git log | ||||||
| LATEST_STABLE=$(git describe --tags --abbrev=0 --match 'v[0-9]*' --exclude '*-*' HEAD^ 2>/dev/null || echo "") | ||||||
|
||||||
| LATEST_STABLE=$(git describe --tags --abbrev=0 --match 'v[0-9]*' --exclude '*-*' HEAD^ 2>/dev/null || echo "") | |
| LATEST_STABLE=$(git describe --tags --abbrev=0 --match 'v[0-9]*' --exclude '*-*' HEAD 2>/dev/null || echo "") |


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow can be triggered by both the daily schedule and
workflow_dispatch. Without aconcurrencygroup, two runs can overlap and race while creating/pushing the same tag (one run may fail with “tag already exists” after the other pushes). Add aconcurrencyblock (similar to.github/workflows/e2e.yml) to ensure only one nightly-tag job runs at a time.