Skip to content

Commit a50c0b4

Browse files
committed
ci: goreleaser merge
1 parent 8e796cb commit a50c0b4

File tree

2 files changed

+99
-56
lines changed

2 files changed

+99
-56
lines changed

.github/workflows/goreleaser.yml

-56
This file was deleted.

.github/workflows/release.yml

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
name: goreleaser
3+
4+
on:
5+
push:
6+
tags:
7+
- 'v*.*.*'
8+
workflow_dispatch:
9+
10+
11+
permissions:
12+
contents: write
13+
id-token: write
14+
packages: write
15+
16+
jobs:
17+
prepare:
18+
strategy:
19+
matrix:
20+
os: [ubuntu-latest, macos-latest, windows-latest]
21+
runs-on: ${{ matrix.os }}
22+
env:
23+
flags: ""
24+
steps:
25+
- if: ${{ github.event_name == 'workflow_dispatch' }}
26+
run: echo "flags=--nightly" >> $GITHUB_ENV
27+
- if: matrix.os == 'ubuntu-latest'
28+
run: echo "goos=linux" >> $GITHUB_ENV
29+
- if: matrix.os == 'macos-latest'
30+
run: echo "goos=darwin" >> $GITHUB_ENV
31+
- if: matrix.os == 'windows-latest'
32+
run: echo "goos=windows" >> $GITHUB_ENV
33+
- uses: actions/checkout@v3
34+
with:
35+
fetch-depth: 0
36+
- uses: actions/setup-go@v3
37+
with:
38+
go-version: 1.19
39+
cache: true
40+
- shell: bash
41+
run: |
42+
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
43+
- id: cache
44+
uses: actions/cache@v3
45+
with:
46+
path: dist/${{ env.goos }}
47+
key: ${{ env.goos }}-${{ env.sha_short }}
48+
- uses: goreleaser/goreleaser-action@v4
49+
if: steps.cache.outputs.cache-hit != 'true' # do not run if cache hit
50+
with:
51+
distribution: goreleaser-pro
52+
version: latest
53+
args: release --rm-dist --split ${{ env.flags }}
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
56+
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
57+
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
58+
AUR_KEY: ${{ secrets.AUR_KEY }}
59+
60+
release:
61+
runs-on: ubuntu-latest
62+
needs: prepare
63+
steps:
64+
- uses: actions/checkout@v3
65+
with:
66+
fetch-depth: 0
67+
- uses: actions/setup-go@v3
68+
with:
69+
go-version: 1.19
70+
71+
# copy the cashes from prepare
72+
- shell: bash
73+
run: |
74+
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
75+
- uses: actions/cache@v3
76+
with:
77+
path: dist/linux
78+
key: linux-${{ env.sha_short }}
79+
- uses: actions/cache@v3
80+
with:
81+
path: dist/darwin
82+
key: darwin-${{ env.sha_short }}
83+
- uses: actions/cache@v3
84+
with:
85+
path: dist/windows
86+
key: windows-${{ env.sha_short }}
87+
88+
# release
89+
- uses: goreleaser/goreleaser-action@v4
90+
if: steps.cache.outputs.cache-hit != 'true' # do not run if cache hit
91+
with:
92+
version: latest
93+
distribution: goreleaser-pro
94+
args: continue --merge
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
98+
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
99+
AUR_KEY: ${{ secrets.AUR_KEY }}

0 commit comments

Comments
 (0)