Skip to content

Commit 3c7aa8f

Browse files
committed
feat(init): rewrite to go
1 parent 155ae56 commit 3c7aa8f

46 files changed

Lines changed: 1833 additions & 3351 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/external/cliff.toml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
[changelog]
2+
header = """
3+
# Changelog\n
4+
All notable changes to this project will be documented in this file.\n
5+
"""
6+
body = """
7+
{% if version %}\
8+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
9+
{% else %}\
10+
## [Initial Release] - {{ timestamp | date(format="%Y-%m-%d") }}
11+
{% endif %}\
12+
{% for group, commits in commits | group_by(attribute="group") %}
13+
### {{ group | upper_first }}
14+
{% for commit in commits %}
15+
- {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }}))
16+
{% endfor %}
17+
{% endfor %}\n
18+
"""
19+
trim = true
20+
footer = """
21+
<!-- generated by git-cliff -->
22+
"""
23+
24+
[git]
25+
conventional_commits = true
26+
filter_unconventional = false
27+
split_commits = false
28+
commit_preprocessors = [
29+
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/HanSoBored/Auto-Linux/issues/${2}))" },
30+
]
31+
commit_parsers = [
32+
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
33+
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
34+
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
35+
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
36+
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
37+
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
38+
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
39+
{ message = "^chore\\(release\\): prepare for", skip = true },
40+
{ message = "^chore", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
41+
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
42+
]
43+
protect_breaking_commits = false
44+
filter_commits = false
45+
tag_pattern = "v[0-9].*"
46+
skip_tags = "beta|alpha"
47+
ignore_tags = ""
48+
sort_commits = "oldest"

.github/workflows/build.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: Release & Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
paths:
9+
- 'VERSION'
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
check-version:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
version: ${{ steps.get_version.outputs.version }}
19+
tag_exists: ${{ steps.check_tag.outputs.exists }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Get version
23+
id: get_version
24+
run: |
25+
VERSION=$(cat VERSION | tr -d '[:space:]')
26+
echo "version=$VERSION" >> $GITHUB_OUTPUT
27+
- name: Check Tag
28+
id: check_tag
29+
run: |
30+
git fetch --tags
31+
if git rev-parse "v${{ steps.get_version.outputs.version }}" >/dev/null 2>&1; then
32+
echo "exists=true" >> $GITHUB_OUTPUT
33+
else
34+
echo "exists=false" >> $GITHUB_OUTPUT
35+
fi
36+
37+
build-binaries:
38+
needs: check-version
39+
if: needs.check-version.outputs.tag_exists == 'false'
40+
name: Build ${{ matrix.asset_name }}
41+
runs-on: ${{ matrix.os }}
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
include:
46+
# --- LINUX ---
47+
# Standard Server/Desktop (x86_64)
48+
- os: ubuntu-latest
49+
asset_name: autolinux-linux-x86_64
50+
goos: linux
51+
goarch: amd64
52+
53+
# ARM64 (Raspberry Pi 4, AWS Graviton)
54+
- os: ubuntu-latest
55+
asset_name: autolinux-linux-aarch64
56+
goos: linux
57+
goarch: arm64
58+
59+
# ARMv7 (Raspberry Pi 2/3)
60+
- os: ubuntu-latest
61+
asset_name: autolinux-linux-armv7
62+
goos: linux
63+
goarch: arm
64+
goarm: "7"
65+
66+
# --- MACOS ---
67+
# Apple Silicon (M1/M2/M3)
68+
- os: macos-latest
69+
asset_name: autolinux-darwin-aarch64
70+
goos: darwin
71+
goarch: arm64
72+
73+
# Intel Mac
74+
- os: macos-latest
75+
asset_name: autolinux-darwin-x86_64
76+
goos: darwin
77+
goarch: amd64
78+
79+
steps:
80+
- uses: actions/checkout@v4
81+
82+
- name: Set up Go
83+
uses: actions/setup-go@v5
84+
with:
85+
go-version: '1.25'
86+
87+
- name: Build Binary
88+
env:
89+
GOOS: ${{ matrix.goos }}
90+
GOARCH: ${{ matrix.goarch }}
91+
GOARM: ${{ matrix.goarm || '' }}
92+
run: |
93+
mkdir -p build
94+
go build -ldflags="-s -w" -o build/${{ matrix.asset_name }} ./cmd/autolinux
95+
96+
- name: Prepare Asset
97+
shell: bash
98+
run: |
99+
chmod +x build/${{ matrix.asset_name }}
100+
101+
- name: Upload Artifact
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: binary-${{ matrix.asset_name }}
105+
path: build/${{ matrix.asset_name }}
106+
107+
create-release:
108+
needs: [check-version, build-binaries]
109+
runs-on: ubuntu-latest
110+
steps:
111+
- uses: actions/checkout@v4
112+
with:
113+
fetch-depth: 0
114+
115+
- name: Download Artifacts
116+
uses: actions/download-artifact@v4
117+
with:
118+
pattern: binary-*
119+
merge-multiple: true
120+
path: build
121+
122+
- name: Generate Changelog
123+
uses: orhun/git-cliff-action@v4
124+
id: git_cliff
125+
with:
126+
config: .github/external/cliff.toml
127+
args: --verbose --tag ${{ needs.check-version.outputs.version }} --strip header
128+
env:
129+
OUTPUT: CHANGELOG.md
130+
131+
- name: Create Release
132+
uses: softprops/action-gh-release@v1
133+
with:
134+
tag_name: ${{ needs.check-version.outputs.version }}
135+
name: Release ${{ needs.check-version.outputs.version }}
136+
body: ${{ steps.git_cliff.outputs.content }}
137+
files: |
138+
build/autolinux-linux-x86_64
139+
build/autolinux-linux-aarch64
140+
build/autolinux-linux-armv7
141+
build/autolinux-darwin-aarch64
142+
build/autolinux-darwin-x86_64
143+
draft: false
144+
env:
145+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)