Repository navigation
175 lines (152 loc) · 5.08 KB
/
Copy pathrelease.yml
File metadata and controls
175 lines (152 loc) · 5.08 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., v1.0.0)'
required: true
type: string
env:
GO_VERSION: '1.25'
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: linux
arch: amd64
bin_name: bugx
- os: linux
arch: arm64
bin_name: bugx
- os: darwin
arch: amd64
bin_name: bugx
- os: darwin
arch: arm64
bin_name: bugx
- os: windows
arch: amd64
bin_name: bugx.exe
- os: windows
arch: arm64
bin_name: bugx.exe
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Get version from tag
id: get_version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION=${GITHUB_REF#refs/tags/}
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Version: ${VERSION}"
- name: Build binary
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: 0
run: |
mkdir -p bin
OUTPUT_NAME="bin/bugx-${{ matrix.os }}-${{ matrix.arch }}"
if [ "${{ matrix.os }}" == "windows" ]; then
OUTPUT_NAME="${OUTPUT_NAME}.exe"
fi
go build -ldflags="-w -s" \
-o ${OUTPUT_NAME} \
./bugx
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: bugx-${{ matrix.os }}-${{ matrix.arch }}
path: bin/bugx-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.os == 'windows' && '.exe' || '' }}
retention-days: 30
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version from tag
id: get_version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION=${GITHUB_REF#refs/tags/}
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Version: ${VERSION}"
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release files
run: |
mkdir -p release
# Copy all binaries to release directory
find artifacts -type f -name 'bugx-*' -exec cp {} release/ \;
# Create checksums
cd release
find . -type f -name 'bugx-*' -exec sha256sum {} \; > checksums.txt
cat checksums.txt
ls -lh
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.get_version.outputs.version }}
name: Release ${{ steps.get_version.outputs.version }}
body: |
## BugX CLI ${{ steps.get_version.outputs.version }}
### Installation
Download the binary for your platform:
**Linux:**
```bash
# AMD64
wget https://github.com/${{ github.repository }}/releases/download/${{ steps.get_version.outputs.version }}/bugx-linux-amd64
chmod +x bugx-linux-amd64
sudo mv bugx-linux-amd64 /usr/local/bin/bugx
# ARM64
wget https://github.com/${{ github.repository }}/releases/download/${{ steps.get_version.outputs.version }}/bugx-linux-arm64
chmod +x bugx-linux-arm64
sudo mv bugx-linux-arm64 /usr/local/bin/bugx
```
**macOS:**
```bash
# AMD64
wget https://github.com/${{ github.repository }}/releases/download/${{ steps.get_version.outputs.version }}/bugx-darwin-amd64
chmod +x bugx-darwin-amd64
sudo mv bugx-darwin-amd64 /usr/local/bin/bugx
# ARM64 (Apple Silicon)
wget https://github.com/${{ github.repository }}/releases/download/${{ steps.get_version.outputs.version }}/bugx-darwin-arm64
chmod +x bugx-darwin-arm64
sudo mv bugx-darwin-arm64 /usr/local/bin/bugx
```
**Windows:**
- Download `bugx-windows-amd64.exe` or `bugx-windows-arm64.exe`
- Rename to `bugx.exe`
- Add to your PATH
### Checksums
See `checksums.txt` for SHA256 checksums of all binaries.
### What's Changed
- See [CHANGELOG](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details
files: |
release/bugx-*
release/checksums.txt
draft: false
prerelease: false