File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Release Workflow
2+
3+ on :
4+ push :
5+ tags :
6+ - " v*"
7+
8+ jobs :
9+ build :
10+ name : Build and Release Binaries
11+ runs-on : ubuntu-latest
12+
13+ strategy :
14+ matrix :
15+ goos : [linux, darwin, windows]
16+ goarch : [amd64, arm64]
17+
18+ steps :
19+ - name : Checkout code
20+ uses : actions/checkout@v4
21+
22+ - name : Set up Go
23+ uses : actions/setup-go@v4
24+ with :
25+ go-version : 1.24
26+
27+ - name : Build binary
28+ run : |
29+ mkdir -p dist
30+ GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o dist/backup-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/backup.go
31+
32+ - name : Generate SHA256 checksum
33+ run : |
34+ for file in dist/*; do
35+ sha256sum "$file" > "$file.sha256";
36+ done
37+
38+ - name : Upload binaries
39+ uses : actions/upload-artifact@v4
40+ with :
41+ name : backup-${{ matrix.goos }}-${{ matrix.goarch }}
42+ path : dist/backup-${{ matrix.goos }}-${{ matrix.goarch }}
43+
44+ - name : Upload SHA256 checksum files
45+ uses : actions/upload-artifact@v4
46+ with :
47+ name : sha256-checksums-${{ matrix.goos }}-${{ matrix.goarch }}
48+ path : dist/*.sha256
49+
50+ release :
51+ name : Publish Release
52+ needs : build
53+ runs-on : ubuntu-latest
54+
55+ steps :
56+ - name : Download all artifacts
57+ uses : actions/download-artifact@v4
58+ with :
59+ path : dist
60+ merge-multiple : true
61+
62+ - name : Create GitHub Release
63+ uses : ncipollo/release-action@v1
64+ with :
65+ artifacts : dist/*
66+ token : ${{ secrets.GITHUB_TOKEN }}
67+ tag : ${{ github.ref_name }}
68+ name : Release ${{ github.ref_name }}
69+ body : |
70+ Release ${{ github.ref_name }} includes binaries for the following platforms:
71+ - Linux (amd64, arm64)
72+ - macOS (amd64, arm64)
73+ - Windows (amd64, arm64)
You can’t perform that action at this time.
0 commit comments