Skip to content

Commit fabb2b8

Browse files
committed
GH-A: use github actions releaser (#62)
1 parent 0412079 commit fabb2b8

File tree

3 files changed

+103
-43
lines changed

3 files changed

+103
-43
lines changed

.github/workflows/release.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
push:
8+
tags:
9+
- v*
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
release:
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
matrix:
19+
os: [ubuntu-latest, macos-latest, windows-latest, macos-13]
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
ref: ${{ github.event.inputs.tag != '' && format('refs/tags/{0}', github.event.inputs.tag) || github.ref }}
24+
25+
- uses: actions/setup-go@v5
26+
with:
27+
go-version-file: 'go.mod'
28+
29+
- name: Setup yq
30+
if: runner.os == 'Windows'
31+
uses: dcarbone/install-yq-action@v1
32+
33+
- name: Copy goreleaser config to temp location
34+
run: cp .goreleaser.yml ${{ runner.temp }}/.goreleaser.yml
35+
- name: Override builds in copied config
36+
run: yq${{ runner.os == 'Windows' && '.exe' || '' }} -i eval '.builds |= map(select(.id == "${{ matrix.os }}"))' ${{ runner.temp }}/.goreleaser.yml
37+
38+
- uses: goreleaser/goreleaser-action@v6
39+
with:
40+
args: release --clean --config ${{ runner.temp }}/.goreleaser.yml
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
GORELEASER_CURRENT_TAG: ${{ github.event.inputs.tag != '' && github.event.inputs.tag || '' }}

.goreleaser.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
version: 2
2+
builds:
3+
- id: ubuntu-latest
4+
main: ./cmd/gof5
5+
goos: [linux]
6+
goarch: [amd64]
7+
flags:
8+
- -trimpath
9+
ldflags:
10+
- -s -w -X main.Version=v{{ .Version }}
11+
env:
12+
- CGO_ENABLED=1
13+
14+
- id: windows-latest
15+
main: ./cmd/gof5
16+
goos: [windows]
17+
goarch: [amd64]
18+
flags:
19+
- -trimpath
20+
ldflags:
21+
- -s -w -X main.Version=v{{ .Version }}
22+
env:
23+
- CGO_ENABLED=1
24+
25+
- id: macos-13
26+
main: ./cmd/gof5
27+
goos: [darwin]
28+
goarch: [amd64]
29+
flags:
30+
- -trimpath
31+
ldflags:
32+
- -s -w -X main.Version=v{{ .Version }}
33+
env:
34+
- CGO_ENABLED=1
35+
36+
- id: macos-latest
37+
main: ./cmd/gof5
38+
goos: [darwin]
39+
goarch: [arm64]
40+
flags:
41+
- -trimpath
42+
ldflags:
43+
- -s -w -X main.Version=v{{ .Version }}
44+
env:
45+
- CGO_ENABLED=1
46+
47+
archives:
48+
- formats: [binary]
49+
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
50+
51+
checksum:
52+
split: true
53+
54+
release:
55+
draft: true
56+
use_existing_draft: true
57+
replace_existing_draft: false
58+
59+
changelog:
60+
disable: true

.travis.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)