91 lines
2.7 KiB
YAML
91 lines
2.7 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 2>/dev/null || echo "v0.0.0")
|
|
if [[ "$BASE" == *"-nightly"* ]]; then
|
|
# already a nightly tag, just strip the suffix
|
|
NEXT_BASE=${BASE%%-nightly*}
|
|
else
|
|
# stable tag, increment patch version
|
|
CLEAN=${BASE%%-nightly*}
|
|
VERSION_NUM=${CLEAN#v}
|
|
IFS='.' read -r major minor patch <<< "$VERSION_NUM"
|
|
patch=$((patch + 1))
|
|
NEXT_BASE="v${major}.${minor}.${patch}"
|
|
fi
|
|
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" main.go
|
|
|
|
cd dist
|
|
tar -czf "iris_${GOOS}_${GOARCH}.tar.gz" "iris"
|
|
rm "iris"
|
|
cd ..
|
|
done
|
|
|
|
- name: Delete existing nightly release
|
|
run: |
|
|
gh release delete nightly --yes 2>/dev/null || true
|
|
git tag -d nightly 2>/dev/null || true
|
|
git push origin --delete nightly 2>/dev/null || true
|
|
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 }}
|