Nightly release #1387
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly release | |
on: | |
schedule: | |
- cron: "10 0 * * *" | |
workflow_dispatch: | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
with: | |
ref: v2 | |
fetch-depth: 0 # it is required for the changelog to work correctly. | |
- name: Set env | |
run: | | |
git fetch --tags | |
full=$(git describe --abbrev --tags --always) | |
version=$(echo "$full" | cut -d- -f1) | |
rev=$(echo "$full" | cut -d- -f2- | sha1sum | cut -d' ' -f1) | |
echo "NIGHTLY_VERSION=${version}-nightly-${rev}" >> $GITHUB_ENV | |
- name: Check for same revision exists | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set +e | |
gh release list | grep "${{ env.NIGHTLY_VERSION }}" | |
if [ $? -eq 0 ]; then | |
echo "${{ env.NIGHTLY_VERSION }} already exists" | |
else | |
echo "DO_RELEASE=true" >> $GITHUB_ENV | |
git tag "${{ env.NIGHTLY_VERSION }}" | |
fi | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: ${{ env.DO_RELEASE }} |