Skip to content

Commit b249020

Browse files
author
Sergey Egorov
committed
Add automatic release build
1 parent c0e6e0a commit b249020

File tree

4 files changed

+91
-1
lines changed

4 files changed

+91
-1
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- uses: actions/checkout@v4
2020

2121
- name: Set up Go
22-
uses: actions/setup-go@v4
22+
uses: actions/setup-go@v5
2323
with:
2424
go-version: '1.22.8'
2525

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# .github/workflows/release.yml
2+
name: goreleaser
3+
4+
on:
5+
pull_request:
6+
push:
7+
# run only against tags
8+
tags:
9+
- "*"
10+
11+
permissions:
12+
contents: write
13+
# packages: write
14+
# issues: write
15+
# id-token: write
16+
17+
jobs:
18+
goreleaser:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
- name: Set up Go
26+
uses: actions/setup-go@v5
27+
with:
28+
go-version: '1.22.8'
29+
# More assembly might be required: Docker logins, GPG, etc.
30+
# It all depends on your needs.
31+
- name: Run GoReleaser
32+
uses: goreleaser/goreleaser-action@v6
33+
with:
34+
# either 'goreleaser' (default) or 'goreleaser-pro'
35+
distribution: goreleaser
36+
# 'latest', 'nightly', or a semver
37+
version: "~> v2"
38+
args: release --clean
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.*
22
!.gitignore
33
!.keepme
4+
!.goreleaser.yaml
5+
!/.github*
46
testdata/tmp
57
/swamp
68
/swamp-ui-dev
@@ -9,3 +11,4 @@ testdata/tmp
911
vendor/
1012
cover.out
1113
cover.html
14+
dist/

.goreleaser.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This is an example .goreleaser.yml file with some sensible defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
4+
# The lines below are called `modelines`. See `:help modeline`
5+
# Feel free to remove those if you don't want/need to use them.
6+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
7+
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
8+
9+
version: 2
10+
11+
before:
12+
hooks:
13+
# You may remove this if you don't use go modules.
14+
- go mod tidy
15+
# you may remove this if you don't need go generate
16+
- go generate ./...
17+
18+
builds:
19+
- env:
20+
- CGO_ENABLED=0
21+
goos:
22+
- linux
23+
- windows
24+
- darwin
25+
main: ./cmd/swamp
26+
27+
archives:
28+
- format: tar.gz
29+
# this name template makes the OS and Arch compatible with the results of `uname`.
30+
name_template: >-
31+
{{ .ProjectName }}_
32+
{{- title .Os }}_
33+
{{- if eq .Arch "amd64" }}x86_64
34+
{{- else if eq .Arch "386" }}i386
35+
{{- else }}{{ .Arch }}{{ end }}
36+
{{- if .Arm }}v{{ .Arm }}{{ end }}
37+
# use zip for windows archives
38+
format_overrides:
39+
- goos: windows
40+
format: zip
41+
42+
changelog:
43+
sort: asc
44+
filters:
45+
exclude:
46+
- "^docs:"
47+
- "^test:"

0 commit comments

Comments
 (0)