Skip to content

Commit 1ddfd82

Browse files
committed
Setup goreleaser
Signed-off-by: Hiroshi Muraoka <[email protected]>
1 parent 17cb6ad commit 1ddfd82

File tree

2 files changed

+60
-16
lines changed

2 files changed

+60
-16
lines changed

.github/workflows/release.yml

+23-16
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
name: Release
22

33
on:
4-
release:
5-
types: [created]
4+
push:
5+
tags:
6+
- 'v*'
67

78
jobs:
8-
releases-matrix:
9-
name: Release Go Binary
9+
goreleaser:
10+
name: Release
1011
runs-on: ubuntu-latest
11-
strategy:
12-
matrix:
13-
goos: [linux, windows, darwin]
14-
goarch: [amd64]
12+
timeout-minutes: 30
13+
permissions:
14+
contents: write
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v2
18-
- uses: wangyoucao577/[email protected]
17+
uses: actions/checkout@v4
1918
with:
20-
github_token: ${{ secrets.GITHUB_TOKEN }}
21-
goos: ${{ matrix.goos }}
22-
goarch: ${{ matrix.goarch }}
23-
goversion: 1.20
24-
pre_command: export CGO_ENABLED=0
25-
project_path: "./sql-migrate"
19+
fetch-depth: 0
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version-file: go.mod
25+
26+
- name: Run GoReleaser
27+
uses: goreleaser/goreleaser-action@v6
28+
with:
29+
version: '~> v2'
30+
args: release --clean
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
2+
version: 2
3+
4+
builds:
5+
- binary: sql-migrate
6+
main: ./sql-migrate/main.go
7+
goos:
8+
- darwin
9+
- linux
10+
goarch:
11+
- '386'
12+
- amd64
13+
- arm64
14+
goarm:
15+
- '6'
16+
ignore:
17+
- goos: darwin
18+
goarch: '386'
19+
env:
20+
- CGO_ENABLED=0
21+
mod_timestamp: '{{ .CommitTimestamp }}'
22+
flags:
23+
- -trimpath
24+
ldflags:
25+
- -s -w
26+
27+
gomod:
28+
proxy: true
29+
30+
archives:
31+
- name_template: "{{.Binary}}_{{.Os}}_{{.Arch}}"
32+
files:
33+
- README.md
34+
- LICENSE
35+
36+
release:
37+
draft: false

0 commit comments

Comments
 (0)