Repository navigation
97 lines (84 loc) · 2.24 KB
/
Copy pathrelease.yml
File metadata and controls
97 lines (84 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Release
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
tag:
description: "Tag to release (e.g. v0.1.0)"
required: true
permissions:
contents: write
jobs:
build:
name: Build binaries
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: darwin
goarch: arm64
artifact: dtasks-macos-arm64
- goos: darwin
goarch: amd64
artifact: dtasks-macos-amd64
- goos: linux
goarch: amd64
artifact: dtasks-linux-amd64
- goos: linux
goarch: arm64
artifact: dtasks-linux-arm64
- goos: windows
goarch: amd64
artifact: dtasks-windows-amd64
ext: .exe
- goos: windows
goarch: arm64
artifact: dtasks-windows-arm64
ext: .exe
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for git describe
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: |
VERSION=${{ github.event.inputs.tag || github.ref_name }}
go build \
-ldflags="-s -w -X main.version=${VERSION}" \
-o ${{ matrix.artifact }}${{ matrix.ext }} \
.
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}${{ matrix.ext }}
retention-days: 1
release:
name: Create release
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Checksums
working-directory: dist
run: sha256sum * > checksums.txt
- name: Create GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG=${{ github.event.inputs.tag || github.ref_name }}
gh release create "${TAG}" \
--title "${TAG}" \
--generate-notes \
dist/*