Skip to content

Commit 1ed2e1d

Browse files
committed
Add release workflow.
1 parent 5fc6d76 commit 1ed2e1d

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# This workflow will build a golang project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3+
4+
name: Release
5+
6+
on:
7+
push:
8+
# Sequence of patterns matched against refs/tags
9+
tags:
10+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
build:
17+
name: Create Release
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Go
24+
uses: actions/setup-go@v4
25+
with:
26+
go-version: '1.22'
27+
28+
- run: mkdir ~/build
29+
30+
- name: Build
31+
shell: bash
32+
run: |
33+
set +e
34+
go tool dist list | while IFS='/' read -ra TARGET
35+
do
36+
export GOOS=${TARGET[0]}
37+
export GOARCH=${TARGET[1]}
38+
echo "Building target $GOOS/$GOARCH"
39+
go build -o ~/build/analytics-server-${{ github.ref_name }}-$GOOS-$GOARCH ./cmd/analytics-server
40+
done
41+
42+
- name: Compress via Zstd
43+
run: zstd ~/build/analytics-server-${{ github.ref_name }}-*
44+
45+
- name: Generate Checksums
46+
run: sha256sum ~/build/*zst > ~/build/SHA256SUMS.txt
47+
48+
- name: Create Release
49+
id: create_release
50+
uses: actions/create-release@v1
51+
env:
52+
GITHUB_TOKEN: ${{ github.token }}
53+
with:
54+
tag_name: ${{ github.ref_name }}
55+
release_name: ${{ github.ref_name }}
56+
body: Changelog for ${{ github.ref_name }}
57+
draft: true
58+
prerelease: false
59+
60+
- name: Upload Artifact
61+
env:
62+
GH_TOKEN: ${{ github.token }}
63+
run:
64+
gh release -R ${{ github.repository }} upload ${{ github.ref_name }} ~/build/SHA256SUMS.txt ~/build/*zst --clobber

0 commit comments

Comments
 (0)