-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (71 loc) · 2.45 KB
/
Copy pathrelease.yml
File metadata and controls
90 lines (71 loc) · 2.45 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
# Copyright 2025 Théotime LEVEQUE
# SPDX-License-Identifier: MIT
name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25.x"
cache: true
- name: Build binaries
run: |
# Linux AMD64
GOOS=linux GOARCH=amd64 go build -o build/znews-linux-amd64 .
# Linux ARM64
GOOS=linux GOARCH=arm64 go build -o build/znews-linux-arm64 .
# macOS AMD64 (Intel)
GOOS=darwin GOARCH=amd64 go build -o build/znews-darwin-amd64 .
# macOS ARM64 (Apple Silicon)
GOOS=darwin GOARCH=arm64 go build -o build/znews-darwin-arm64 .
# Windows AMD64
GOOS=windows GOARCH=amd64 go build -o build/znews-windows-amd64.exe .
- name: Generate changelog
id: changelog
run: |
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
if [ -z "$PREV_TAG" ]; then
CHANGELOG=$(git log --pretty=format:"- %s (%h)" HEAD)
else
CHANGELOG=$(git log --pretty=format:"- %s (%h)" ${PREV_TAG}..HEAD)
fi
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
build/znews-linux-amd64
build/znews-linux-arm64
build/znews-darwin-amd64
build/znews-darwin-arm64
build/znews-windows-amd64.exe
body: |
## Changes
${{ steps.changelog.outputs.changelog }}
## Installation
Download the appropriate binary for your platform and add it to your PATH.
### Linux/macOS
```bash
chmod +x znews-*
sudo mv znews-* /usr/local/bin/znews
```
### Windows
Add `znews-windows-amd64.exe` to your PATH or rename it to `znews.exe`.
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}