|
1 | 1 | name: Release |
2 | | - |
3 | 2 | on: |
4 | 3 | push: |
5 | | - tags: |
6 | | - - 'v*' |
7 | | - |
| 4 | + tags: ['v*'] |
8 | 5 | permissions: |
9 | 6 | contents: write |
10 | | - |
11 | 7 | env: |
12 | 8 | GONOSUMCHECK: github.com/GoCodeAlone/* |
13 | 9 | GONOSUMDB: github.com/GoCodeAlone/* |
14 | 10 | GOPRIVATE: github.com/GoCodeAlone/* |
15 | | - |
16 | 11 | jobs: |
17 | 12 | release: |
18 | | - name: Build and Release |
19 | 13 | runs-on: ubuntu-latest |
20 | 14 | steps: |
21 | 15 | - uses: actions/checkout@v4 |
22 | 16 | with: |
23 | 17 | fetch-depth: 0 |
24 | | - |
25 | 18 | - uses: actions/setup-go@v5 |
26 | 19 | with: |
27 | 20 | go-version: '1.26' |
28 | 21 | cache: true |
29 | | - |
30 | 22 | - name: Configure git for private modules |
31 | 23 | run: git config --global url."https://${{ secrets.RELEASES_TOKEN }}@github.com/".insteadOf "https://github.com/" |
32 | | - |
33 | | - - name: Resolve dependencies |
34 | | - run: go mod tidy |
35 | | - |
36 | | - - name: Build binaries |
37 | | - run: | |
38 | | - VERSION=${GITHUB_REF#refs/tags/} |
39 | | - LDFLAGS="-ldflags \"-X main.version=${VERSION}\"" |
40 | | -
|
41 | | - declare -a PLATFORMS=("linux/amd64" "linux/arm64" "darwin/amd64" "darwin/arm64") |
42 | | - mkdir -p bin |
43 | | -
|
44 | | - for platform in "${PLATFORMS[@]}"; do |
45 | | - os="${platform%%/*}" |
46 | | - arch="${platform##*/}" |
47 | | - output="bin/workflow-plugin-bento-${os}-${arch}" |
48 | | - echo "Building ${output}..." |
49 | | - GOOS=${os} GOARCH=${arch} go build -ldflags "-X main.version=${VERSION}" \ |
50 | | - -o "${output}" ./cmd/workflow-plugin-bento |
51 | | - done |
52 | | -
|
53 | | - ls -la bin/ |
54 | | -
|
55 | | - - name: Create release archives |
56 | | - run: | |
57 | | - mkdir -p dist |
58 | | - for binary in bin/workflow-plugin-bento-*; do |
59 | | - name=$(basename "${binary}") |
60 | | - tar -czf "dist/${name}.tar.gz" -C bin "${name}" |
61 | | - sha256sum "dist/${name}.tar.gz" >> dist/checksums.txt |
62 | | - done |
63 | | - cp plugin.json dist/ 2>/dev/null || echo '{"name":"workflow-plugin-bento","version":"'${GITHUB_REF#refs/tags/}'"}' > dist/plugin.json |
64 | | - ls -la dist/ |
65 | | -
|
66 | | - - name: Create GitHub Release |
67 | | - uses: softprops/action-gh-release@v2 |
| 24 | + - name: Run GoReleaser |
| 25 | + uses: goreleaser/goreleaser-action@v7 |
68 | 26 | with: |
69 | | - files: | |
70 | | - dist/*.tar.gz |
71 | | - dist/checksums.txt |
72 | | - dist/plugin.json |
73 | | - generate_release_notes: true |
74 | | - draft: false |
75 | | - prerelease: false |
| 27 | + version: '~> v2' |
| 28 | + args: release --clean |
| 29 | + env: |
| 30 | + GITHUB_TOKEN: ${{ secrets.RELEASES_TOKEN }} |
0 commit comments