-
Notifications
You must be signed in to change notification settings - Fork 1
139 lines (112 loc) · 4.32 KB
/
release.yaml
File metadata and controls
139 lines (112 loc) · 4.32 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
name: Release
on:
push:
tags:
- 'v*.*.*' # Trigger on version tags like v1.0.0
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version: ["1.20"]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Create release dir
run: mkdir -p release
- name: Build binary
shell: bash
run: |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
GOOS=linux GOARCH=amd64 go build -o release/gores-linux-amd64 main.go
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
GOOS=darwin GOARCH=amd64 go build -o release/gores-darwin-amd64 main.go
else
GOOS=windows GOARCH=amd64 go build -o release/gores-windows-amd64.exe main.go
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-binary
path: release/*
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: ubuntu-latest-binary
path: release
- name: Download macOS artifact
uses: actions/download-artifact@v4
with:
name: macos-latest-binary
path: release
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: windows-latest-binary
path: release
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: 🚀 Go Microservice Boilerplate ${{ github.ref_name }}
files: |
release/gores-linux-amd64
release/gores-darwin-amd64
release/gores-windows-amd64.exe
body: |
## 📦 Go Microservice Boilerplate — ${{ github.ref_name }}
Precompiled binaries are available for **Linux**, **macOS**, and **Windows**.
### 🔽 1. Download Binaries
- **Linux (x86_64)** → [gores-linux-amd64](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/gores-linux-amd64)
- **macOS (x86_64)** → [gores-darwin-amd64](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/gores-darwin-amd64)
- **Windows (x86_64)** → [gores-windows-amd64.exe](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/gores-windows-amd64.exe)
#### Linux / macOS
```bash
curl -L -o gores https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/gores-linux-amd64
chmod +x gores
./gores
```
#### Windows (PowerShell)
```powershell
Invoke-WebRequest -Uri "https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/gores-windows-amd64.exe" -OutFile "gores.exe"
.\gores.exe
```
---
### 💻 2. Install via `go install` (Go 1.17+)
```bash
go install github.com/${{ github.repository }}@${{ github.ref_name }}
```
This will install the binary into your `$GOPATH/bin` or `$HOME/go/bin`.
---
### 📥 3. Install via `go get` (older Go versions)
```bash
go get github.com/${{ github.repository }}@${{ github.ref_name }}
```
---
### 🛠 4. Build from Source
```bash
git clone https://github.com/${{ github.repository }}.git
cd $(basename $_ .git)
go mod tidy
go build -o gores ./cmd
```
---
### 📚 Documentation
For full docs and usage examples, see [README.md](https://github.com/${{ github.repository }}#readme)
---
_Built automatically via GitHub Actions._
env:
GITHUB_TOKEN: ${{ secrets.MY_PAT }}