-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (72 loc) · 2.46 KB
/
release.yml
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
name: Release Workflow
on:
push:
tags:
- "v*.*.*" # Trigger the workflow when a version tag is pushed
permissions:
contents: write
jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout
uses: actions/checkout@v4
# Fetch all tags
- name: Fetch Tags
run: git fetch --force --tags
# Setup Go environment
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
# Build the binary for multiple platforms
- name: Build Binary
run: |
mkdir -p dist
GOOS=linux GOARCH=amd64 go build -o dist/halcyon-linux-amd64 main.go
GOOS=darwin GOARCH=arm64 go build -o dist/halcyon-darwin-arm64 main.go
GOOS=windows GOARCH=amd64 go build -o dist/halcyon-windows-amd64.exe main.go
# Compress the binaries
- name: Compress Binaries
run: |
cd dist
zip halcyon-linux-amd64.zip halcyon-linux-amd64
zip halcyon-darwin-arm64.zip halcyon-darwin-arm64
zip halcyon-windows-amd64.zip halcyon-windows-amd64.exe
# Create GitHub Release
- name: Generate Release Notes
id: release-notes
run: |
echo "# Halcyon ${{ github.ref_name }} 🚀" >> release-notes.md
echo "" >> release-notes.md
echo "## ✨ Features" >> release-notes.md
echo "" >> release-notes.md
echo "---" >> release-notes.md
echo "" >> release-notes.md
echo "## 🛠 Installation" >> release-notes.md
echo "" >> release-notes.md
echo "For macOS, Linux, and Windows:" >> release-notes.md
echo "1. Download the latest release binary from the [Releases](https://github.com/tejastn10/halcyon/releases) page." >> release-notes.md
echo "2. Extract the binary and add it to your system’s PATH." >> release-notes.md
echo "" >> release-notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
body_path: release-notes.md
draft: false
prerelease: false
files: dist/*.zip
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
npm:
name: Publish to NPM
needs: build
runs-on: ubuntu-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22