-
-
Notifications
You must be signed in to change notification settings - Fork 90
51 lines (46 loc) · 1.42 KB
/
nightly.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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 }}