-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (82 loc) · 2.37 KB
/
release.yml
File metadata and controls
95 lines (82 loc) · 2.37 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
name: Release (binaries)
on:
push:
tags:
- "v*"
- "cli-*"
permissions:
contents: write
jobs:
build:
name: Build binaries (${{ matrix.goos }}-${{ matrix.goarch }})
strategy:
fail-fast: false
matrix:
include:
- goos: windows
goarch: amd64
ext: .exe
- goos: linux
goarch: amd64
ext: ""
- goos: darwin
goarch: amd64
ext: ""
- goos: darwin
goarch: arm64
ext: ""
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Compute build metadata
id: meta
run: |
echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
echo "commit=${GITHUB_SHA}" >> $GITHUB_OUTPUT
echo "date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Build digiemu
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
mkdir -p dist
BIN="digiemu-${{ steps.meta.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.ext }}"
go build \
-trimpath \
-ldflags "-s -w -X main.Version=${{ steps.meta.outputs.version }} -X main.Commit=${{ steps.meta.outputs.commit }} -X main.Date=${{ steps.meta.outputs.date }}" \
-o "dist/$BIN" \
./cmd/digiemu
echo "Built dist/$BIN"
./dist/$BIN --version || true
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: digiemu-${{ steps.meta.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/*
release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist_all
- name: Flatten artifacts
run: |
mkdir -p dist
find dist_all -type f -maxdepth 3 -print -exec cp {} dist/ \;
ls -la dist
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: true