Skip to content

Commit e776010

Browse files
committed
add release workflow, modernize goreleaser config
- add release.yml workflow using goreleaser-action - update .goreleaser.yml to v2 format - remove obsolete Dockerfile.artifacts - simplify Makefile dist target to use goreleaser directly
1 parent 341a3e5 commit e776010

File tree

5 files changed

+53
-33
lines changed

5 files changed

+53
-33
lines changed

.github/workflows/release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: check out code
16+
uses: actions/checkout@v6
17+
with:
18+
fetch-depth: 0
19+
20+
- name: set up go
21+
uses: actions/setup-go@v6
22+
with:
23+
go-version: "1.25"
24+
25+
- name: run goreleaser
26+
uses: goreleaser/goreleaser-action@v6
27+
with:
28+
version: ~> 2
29+
args: release --clean
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
var/
1818
dist/
19+
.bin/
1920
docker-compose-private.yml
2021
.vscode
2122
.idea

.goreleaser.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
version: 2
2+
project_name: updater
3+
dist: .bin
14
builds:
2-
- env:
5+
- id: updater
6+
binary: "updater"
7+
env:
38
- CGO_ENABLED=0
49
goos:
510
- linux
@@ -10,15 +15,24 @@ builds:
1015
- arm
1116
- arm64
1217
ignore:
13-
- goos: freebsd
18+
- goos: windows
1419
goarch: arm
15-
- goos: freebsd
20+
- goos: windows
1621
goarch: arm64
1722
dir: app
1823
ldflags: "-s -w -X main.revision={{.Tag}}-{{.ShortCommit}}-{{.CommitDate}}"
1924

2025
archives:
21-
- name_template: "{{ .ProjectName }}_{{ .Tag }}_{{ if eq .Os \"darwin\" }}macos{{ else }}{{ .Os }}{{ end }}_{{ .Arch }}"
26+
- id: updater
27+
name_template: >-
28+
{{.ProjectName}}_
29+
{{- .Tag}}_
30+
{{- if eq .Os "darwin"}}macos
31+
{{- else if eq .Os "windows"}}win
32+
{{- else}}{{.Os}}{{end}}_
33+
{{- if eq .Arch "amd64"}}x86_64
34+
{{- else if eq .Arch "386"}}i386
35+
{{- else}}{{.Arch}}{{end}}
2236
format_overrides:
2337
- goos: windows
2438
format: zip

Dockerfile.artifacts

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

Makefile

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,13 @@ docker:
77
docker build -t umputun/updater:master --progress=plain .
88

99
dist:
10-
- @mkdir -p dist
11-
docker build -f Dockerfile.artifacts --progress=plain -t updater.bin .
12-
- @docker rm -f updater.bin 2>/dev/null || exit 0
13-
docker run -d --name=updater.bin updater.bin
14-
docker cp updater.bin:/artifacts dist/
15-
docker rm -f updater.bin
10+
goreleaser --snapshot --clean
1611

1712
race_test:
1813
cd app && go test -race -timeout=60s -count 1 ./...
1914

2015
build: info
21-
- cd app && GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X main.revision=$(REV) -s -w" -o ../dist/updater
16+
cd app && CGO_ENABLED=0 go build -ldflags "-X main.revision=$(REV) -s -w" -o /tmp/updater
2217

2318
site:
2419
@rm -f site/public/*
@@ -30,4 +25,4 @@ site:
3025
info:
3126
- @echo "revision $(REV)"
3227

33-
.PHONY: dist docker race_test bin info site build_site
28+
.PHONY: dist docker race_test build info site

0 commit comments

Comments
 (0)