Files
iris-context/.github/workflows/nightly.yml
T
VERSE a93a31ab4e fix(ci): nightly tags breaking release changelogs (#126)
After released v0.5.0, I saw that v0.5.0 showed only 1 commit changelog
instead of the real 16 commits since v0.4.21

Nightly builds tag every push to main, so a nightly tag can land on the
exact same commit as a stable release tag
GoReleaser picked that nearby nightly as the `previous release` when
building the changelog

Fixes:

- `.goreleaser.yaml`: added `git.ignore_tags`: ["*-nightly.*"] so
changelog diffing skips nightly tags entirely
- `nightly.yml`: the cleanup step deleted a tag named `nightly`, but
each run tags as `v<version>-nightly.<sha>`, so it never actually
deleted anything and nightly tags piled up unbounded. Now deletes all
previous `v*-nightly.*` tags/releases before creating the new one
2026-08-06 10:43:06 +07:00

87 lines
2.6 KiB
YAML

name: Nightly
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
nightly:
name: Nightly Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for git describe
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.24.x'
cache: true
- name: Get version info
id: version
run: |
BASE=$(git describe --tags --abbrev=0 --exclude="*-nightly*" 2>/dev/null || echo "v0.0.0")
VERSION_NUM=${BASE#v}
IFS='.' read -r major minor patch <<< "$VERSION_NUM"
patch=$((patch + 1))
NEXT_BASE="v${major}.${minor}.${patch}"
SHORT=$(git rev-parse --short HEAD)
echo "version=${NEXT_BASE}-nightly.${SHORT}" >> $GITHUB_OUTPUT
- name: Build Binaries
run: |
mkdir -p dist
platforms=("linux/amd64" "linux/arm64" "darwin/amd64" "darwin/arm64")
for platform in "${platforms[@]}"; do
os_arch=(${platform//\// })
GOOS=${os_arch[0]}
GOARCH=${os_arch[1]}
GOOS=$GOOS GOARCH=$GOARCH go build \
-ldflags="-s -w -X github.com/versenilvis/iris/root.Version=${{ steps.version.outputs.version }}" \
-trimpath -o "dist/iris" ./cmd/iris
cd dist
tar -czf "iris_${GOOS}_${GOARCH}.tar.gz" "iris"
rm "iris"
cd ..
done
- name: Delete previous nightly releases
# each run tags as v<version>-nightly.<sha>, a different name every
# time, so leftover nightly tags pile up and skew goreleaser's
# previous-tag detection for the next stable changelog
run: |
for tag in $(git tag --list "v*-nightly.*"); do
gh release delete "$tag" --yes --cleanup-tag 2>/dev/null || true
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Nightly Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.version }}
name: ${{ steps.version.outputs.version }}
body: |
# 🌙 **Nightly build** - `${{ steps.version.outputs.version }}`
Nightly release from commit: ${{ github.sha }}
# Update:
`iris update`
> install manually, this build will **not** trigger an update notification
files: dist/*.tar.gz
prerelease: true
generate_release_notes: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}