-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (135 loc) · 4.07 KB
/
release.yml
File metadata and controls
153 lines (135 loc) · 4.07 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
name: Release & Publish
on:
push:
branches:
- main
- master
paths:
- 'VERSION'
permissions:
contents: write
jobs:
check-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
tag_exists: ${{ steps.check_tag.outputs.exists }}
steps:
- uses: actions/checkout@v4
- name: Get version
id: get_version
run: |
VERSION=$(cat VERSION | tr -d '[:space:]')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Check Tag
id: check_tag
run: |
git fetch --tags
if git rev-parse "v${{ steps.get_version.outputs.version }}" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
build-binaries:
needs: check-version
if: needs.check-version.outputs.tag_exists == 'false'
name: Build ${{ matrix.asset_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# --- LINUX ---
# Standard Server/Desktop (x86_64)
- os: ubuntu-latest
asset_name: autolinux-linux-x86_64
goos: linux
goarch: amd64
# ARM64 (Raspberry Pi 4, AWS Graviton)
- os: ubuntu-latest
asset_name: autolinux-linux-aarch64
goos: linux
goarch: arm64
# Android/Termux ARM64
- os: ubuntu-latest
asset_name: autolinux-android-aarch64
goos: android
goarch: arm64
# ARMv7 (Raspberry Pi 2/3)
- os: ubuntu-latest
asset_name: autolinux-linux-armv7
goos: linux
goarch: arm
goarm: "7"
# --- MACOS ---
# Apple Silicon (M1/M2/M3)
- os: macos-latest
asset_name: autolinux-darwin-aarch64
goos: darwin
goarch: arm64
# Intel Mac
- os: macos-latest
asset_name: autolinux-darwin-x86_64
goos: darwin
goarch: amd64
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build Binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm || '' }}
CGO_ENABLED: 0
run: |
mkdir -p build
go build -ldflags="-s -w" -o build/${{ matrix.asset_name }} ./cmd/autolinux
- name: Prepare Asset
shell: bash
run: |
chmod +x build/${{ matrix.asset_name }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.asset_name }}
path: build/${{ matrix.asset_name }}
create-release:
needs: [check-version, build-binaries]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
pattern: binary-*
merge-multiple: true
path: build
- name: Generate Changelog
uses: orhun/git-cliff-action@v4
id: git_cliff
with:
config: .github/external/cliff.toml
args: --verbose --tag ${{ needs.check-version.outputs.version }} --strip header
env:
OUTPUT: CHANGELOG.md
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.check-version.outputs.version }}
name: Release ${{ needs.check-version.outputs.version }}
body: ${{ steps.git_cliff.outputs.content }}
files: |
build/autolinux-linux-x86_64
build/autolinux-linux-aarch64
build/autolinux-linux-armv7
build/autolinux-android-aarch64
build/autolinux-darwin-aarch64
build/autolinux-darwin-x86_64
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}