-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (59 loc) · 2.09 KB
/
release.yml
File metadata and controls
74 lines (59 loc) · 2.09 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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run tests
run: go test ./...
- name: Build binaries
run: |
VERSION=${GITHUB_REF_NAME}
BUILD_TIME=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
LDFLAGS="-s -w -X github.com/ScaleCommerce-DEV/scdev/cmd.Version=${VERSION} -X github.com/ScaleCommerce-DEV/scdev/cmd.BuildTime=${BUILD_TIME}"
GOOS=darwin GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o scdev-darwin-arm64 .
GOOS=darwin GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o scdev-darwin-amd64 .
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o scdev-linux-amd64 .
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o scdev-linux-arm64 .
- name: Generate checksums
run: |
sha256sum scdev-darwin-arm64 scdev-darwin-amd64 scdev-linux-amd64 scdev-linux-arm64 > checksums.txt
cat checksums.txt
- name: Build release body
run: |
cat > release-body.md << 'HEADER'
## Update
```bash
scdev self-update
```
## Install
**macOS / Linux:**
```bash
curl -fsSL https://raw.githubusercontent.com/ScaleCommerce-DEV/scdev/main/install.sh | sh
```
HEADER
# Extract the latest version section from CHANGELOG.md
if [ -f CHANGELOG.md ]; then
echo "---" >> release-body.md
echo "" >> release-body.md
awk '/^## /{if(found) exit; found=1; next} found{print}' CHANGELOG.md >> release-body.md
fi
- name: Create release
uses: softprops/action-gh-release@v2
with:
body_path: release-body.md
files: |
scdev-darwin-arm64
scdev-darwin-amd64
scdev-linux-amd64
scdev-linux-arm64
checksums.txt