Skip to content

Commit

Permalink
Setup goreleaser
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Muraoka <[email protected]>
  • Loading branch information
tapih committed Oct 17, 2024
1 parent 17cb6ad commit 1ddfd82
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 16 deletions.
39 changes: 23 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
name: Release

on:
release:
types: [created]
push:
tags:
- 'v*'

jobs:
releases-matrix:
name: Release Go Binary
goreleaser:
name: Release
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64]
timeout-minutes: 30
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: wangyoucao577/[email protected]
uses: actions/checkout@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: 1.20
pre_command: export CGO_ENABLED=0
project_path: "./sql-migrate"
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37 changes: 37 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
version: 2

builds:
- binary: sql-migrate
main: ./sql-migrate/main.go
goos:
- darwin
- linux
goarch:
- '386'
- amd64
- arm64
goarm:
- '6'
ignore:
- goos: darwin
goarch: '386'
env:
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- -s -w

gomod:
proxy: true

archives:
- name_template: "{{.Binary}}_{{.Os}}_{{.Arch}}"
files:
- README.md
- LICENSE

release:
draft: false

0 comments on commit 1ddfd82

Please sign in to comment.