-
Notifications
You must be signed in to change notification settings - Fork 0
198 lines (173 loc) · 5.77 KB
/
release.yml
File metadata and controls
198 lines (173 loc) · 5.77 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: Release & Publish
on:
push:
branches:
- main
- master
paths:
- 'VERSION'
workflow_dispatch:
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
# Android x86_64 (Emulator, ChromeOS)
- os: ubuntu-latest
asset_name: autolinux-android-x86_64
goos: android
goarch: amd64
# ARMv7 (Raspberry Pi 2/3)
- os: ubuntu-latest
asset_name: autolinux-linux-armv7
goos: linux
goarch: arm
goarm: "7"
# Android/Termux ARMv7
- os: ubuntu-latest
asset_name: autolinux-android-armv7
goos: android
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: Install NDK for Android builds
if: matrix.goos == 'android'
run: |
set -e
NDK_VERSION="27c"
cd /tmp
echo "Downloading NDK version ${NDK_VERSION}..."
wget --no-verbose https://dl.google.com/android/repository/android-ndk-r${NDK_VERSION}-linux.zip
echo "Extracting NDK..."
unzip -q android-ndk-r${NDK_VERSION}-linux.zip
ANDROID_NDK_HOME=/tmp/android-ndk-r${NDK_VERSION}
TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64
echo "ANDROID_NDK_HOME=$ANDROID_NDK_HOME" >> $GITHUB_ENV
echo "TOOLCHAIN=$TOOLCHAIN" >> $GITHUB_ENV
if [ "${{ matrix.goarch }}" = "arm64" ]; then
echo "CC=$TOOLCHAIN/bin/aarch64-linux-android21-clang" >> $GITHUB_ENV
echo "CGO_ENABLED=1" >> $GITHUB_ENV
elif [ "${{ matrix.goarch }}" = "amd64" ]; then
echo "CC=$TOOLCHAIN/bin/x86_64-linux-android21-clang" >> $GITHUB_ENV
echo "CGO_ENABLED=1" >> $GITHUB_ENV
elif [ "${{ matrix.goarch }}" = "arm" ]; then
echo "CC=$TOOLCHAIN/bin/armv7a-linux-androideabi21-clang" >> $GITHUB_ENV
echo "CGO_ENABLED=1" >> $GITHUB_ENV
fi
echo "NDK setup complete!"
- name: Build Binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm || '' }}
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-android-x86_64
build/autolinux-android-armv7
build/autolinux-darwin-aarch64
build/autolinux-darwin-x86_64
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}