Skip to content

Commit d2f7d88

Browse files
add: GoReleaser
1 parent 880e0b1 commit d2f7d88

File tree

3 files changed

+24
-39
lines changed

3 files changed

+24
-39
lines changed

.github/workflows/release.yml

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,27 @@ on:
66
- "*" # Trigger on tags that start with 'alpha-'
77

88
jobs:
9-
build:
10-
name: Build and Release Binaries
9+
goreleaser:
1110
runs-on: ubuntu-latest
12-
13-
strategy:
14-
matrix:
15-
goos: [linux, windows, darwin]
16-
goarch: [amd64, arm64]
17-
1811
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
2414
with:
25-
go-version: "1.23" # Specify your Go version here
26-
15+
fetch-depth: 0
2716
- name: Get the tag value
2817
id: get_tag
2918
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
30-
3119
- name: Print the tag
3220
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
5225
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
5731
env:
5832
GITHUB_TOKEN: ${{ secrets.RELEASE_CREATION_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

.goreleaser.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
builds:
2+
- main: ./main.go
3+
id: "bridgeftp"
4+
binary: bridgeftp
5+
goos:
6+
- linux
7+
- darwin
8+
- windows
9+
ldflags:
10+
- -X "main.version=${{ .Env.TAG_NAME }}"

0 commit comments

Comments
 (0)