|
6 | 6 | - "*" # Trigger on tags that start with 'alpha-' |
7 | 7 |
|
8 | 8 | jobs: |
9 | | - build: |
10 | | - name: Build and Release Binaries |
| 9 | + goreleaser: |
11 | 10 | runs-on: ubuntu-latest |
12 | | - |
13 | | - strategy: |
14 | | - matrix: |
15 | | - goos: [linux, windows, darwin] |
16 | | - goarch: [amd64, arm64] |
17 | | - |
18 | 11 | steps: |
19 | | - - name: Checkout code |
20 | | - uses: actions/checkout@v3 |
21 | | - |
22 | | - - name: Set up Go |
23 | | - uses: actions/setup-go@v3 |
| 12 | + - name: Checkout |
| 13 | + uses: actions/checkout@v4 |
24 | 14 | with: |
25 | | - go-version: "1.23" # Specify your Go version here |
26 | | - |
| 15 | + fetch-depth: 0 |
27 | 16 | - name: Get the tag value |
28 | 17 | id: get_tag |
29 | 18 | run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV |
30 | | - |
31 | 19 | - name: Print the tag |
32 | 20 | run: echo "Tag value is ${{ env.TAG_NAME }}" |
33 | | - |
34 | | - - name: Build binary |
35 | | - run: | |
36 | | - GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags "-X main.version=${{ env.TAG_NAME }}" -o bridgeftp-${{ matrix.goos }}-${{ matrix.goarch }} |
37 | | -
|
38 | | - - name: Archive binary |
39 | | - run: | |
40 | | - zip bridgeftp-${{ matrix.goos }}-${{ matrix.goarch }}.zip bridgeftp-${{ matrix.goos }}-${{ matrix.goarch }} |
41 | | -
|
42 | | - - name: Create GitHub Release |
43 | | - id: create_release |
44 | | - uses: softprops/action-gh-release@v1 |
45 | | - with: |
46 | | - files: bridgeftp-${{ matrix.goos }}-${{ matrix.goarch }}.zip |
47 | | - env: |
48 | | - GITHUB_TOKEN: ${{ secrets.RELEASE_CREATION_TOKEN }} |
49 | | - |
50 | | - - name: Upload release assets |
51 | | - uses: actions/upload-release-asset@v1 |
| 21 | + - name: Set up Go |
| 22 | + uses: actions/setup-go@v5 |
| 23 | + - name: Run GoReleaser |
| 24 | + uses: goreleaser/goreleaser-action@v6 |
52 | 25 | with: |
53 | | - upload_url: ${{ steps.create_release.outputs.upload_url }} |
54 | | - asset_path: ./bridgeftp-${{ matrix.goos }}-${{ matrix.goarch }}.zip |
55 | | - asset_name: bridgeftp-${{ matrix.goos }}-${{ matrix.goarch }}.zip |
56 | | - asset_content_type: application/zip |
| 26 | + # either 'goreleaser' (default) or 'goreleaser-pro' |
| 27 | + distribution: goreleaser |
| 28 | + # 'latest', 'nightly', or a semver |
| 29 | + version: "~> v2" |
| 30 | + args: release --clean |
57 | 31 | env: |
58 | 32 | GITHUB_TOKEN: ${{ secrets.RELEASE_CREATION_TOKEN }} |
0 commit comments