Skip to content

Commit 75c2981

Browse files
committed
Initial commit
0 parents  commit 75c2981

36 files changed

Lines changed: 9267 additions & 0 deletions

.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[build]
2+
rustflags = ["-C", "target-cpu=native"]

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
**/*
2+
!.cargo
3+
!Cargo.toml
4+
!Cargo.lock
5+
!src/
6+
!wit/

.github/workflows/dev-release.yaml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
name: Dev Release
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
tags-ignore:
8+
- "**"
9+
10+
env:
11+
BIN_NAME: ${{ github.event.repository.name }}
12+
REGISTRY: ghcr.io
13+
14+
permissions:
15+
contents: write
16+
packages: write
17+
18+
jobs:
19+
build-dev:
20+
name: Build ${{ matrix.target }}
21+
runs-on: ${{ matrix.os }}
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
include:
26+
- target: x86_64-unknown-linux-musl
27+
os: ubuntu-latest
28+
install_deps: sudo apt-get update && sudo apt-get install -y musl-tools
29+
- target: x86_64-unknown-linux-gnu
30+
os: ubuntu-latest
31+
install_deps: "false"
32+
- target: aarch64-unknown-linux-musl
33+
os: ubuntu-24.04-arm
34+
install_deps: sudo apt-get update && sudo apt-get install -y musl-tools
35+
- target: aarch64-unknown-linux-gnu
36+
os: ubuntu-24.04-arm
37+
install_deps: "false"
38+
- target: x86_64-apple-darwin
39+
os: macos-15-intel
40+
install_deps: "false"
41+
- target: aarch64-apple-darwin
42+
os: macos-latest
43+
install_deps: "false"
44+
- target: x86_64-pc-windows-msvc
45+
os: windows-latest
46+
install_deps: "false"
47+
- target: aarch64-pc-windows-msvc
48+
os: windows-11-arm
49+
install_deps: "false"
50+
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v6
54+
55+
- name: Install System Dependencies
56+
if: matrix.install_deps != 'false'
57+
run: ${{ matrix.install_deps }}
58+
59+
- name: Install Rust Toolchain
60+
uses: dtolnay/rust-toolchain@master
61+
with:
62+
toolchain: stable
63+
targets: ${{ matrix.target }}
64+
65+
- name: Rust Cache
66+
uses: swatinem/rust-cache@v2
67+
with:
68+
key: ${{ matrix.target }}
69+
70+
- name: Set Dev Version
71+
shell: bash
72+
run: |
73+
BASE_VERSION=$(grep -m1 'version = "' Cargo.toml | cut -d '"' -f 2)
74+
SHORT_SHA=$(git rev-parse --short HEAD)
75+
NEW_VERSION="${BASE_VERSION}-dev.${SHORT_SHA}"
76+
77+
sed -i.bak "s/^version = .*/version = \"$NEW_VERSION\"/" Cargo.toml
78+
79+
- name: Build Binary
80+
run: cargo build --release --target ${{ matrix.target }}
81+
82+
- name: Package Binary
83+
shell: bash
84+
run: |
85+
mkdir dist
86+
cp LICENSE dist/
87+
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
88+
cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}.exe" dist/
89+
cd dist
90+
7z a "../${{ env.BIN_NAME }}-${{ matrix.target }}.zip" "${{ env.BIN_NAME }}.exe" LICENSE
91+
else
92+
cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}" dist/
93+
cd dist
94+
tar -czf "../${{ env.BIN_NAME }}-${{ matrix.target }}.tar.gz" "${{ env.BIN_NAME }}" LICENSE
95+
fi
96+
97+
- name: Upload Artifact
98+
uses: actions/upload-artifact@v6
99+
with:
100+
name: binary-${{ matrix.target }}
101+
path: ${{ env.BIN_NAME }}-${{ matrix.target }}*
102+
retention-days: 1
103+
104+
release-dev:
105+
name: Update Dev Release
106+
needs: build-dev
107+
runs-on: ubuntu-latest
108+
steps:
109+
- name: Download Artifacts
110+
uses: actions/download-artifact@v6
111+
with:
112+
path: artifacts
113+
merge-multiple: true
114+
115+
- name: Update Pre-Release
116+
uses: softprops/action-gh-release@v2
117+
with:
118+
tag_name: dev
119+
name: Development Build
120+
body: "Latest development build from master. Commit: ${{ github.sha }}"
121+
prerelease: true
122+
files: artifacts/*
123+
make_latest: false
124+
125+
docker-dev:
126+
name: Push Dev Docker
127+
runs-on: ubuntu-latest
128+
steps:
129+
- name: Checkout
130+
uses: actions/checkout@v6
131+
132+
- name: Set Dev Version
133+
shell: bash
134+
run: |
135+
BASE_VERSION=$(grep -m1 'version = "' Cargo.toml | cut -d '"' -f 2)
136+
SHORT_SHA=$(git rev-parse --short HEAD)
137+
NEW_VERSION="${BASE_VERSION}-dev.${SHORT_SHA}"
138+
139+
sed -i.bak "s/^version = .*/version = \"$NEW_VERSION\"/" Cargo.toml
140+
141+
- name: Set up QEMU
142+
uses: docker/setup-qemu-action@v3
143+
144+
- name: Set up Docker Buildx
145+
uses: docker/setup-buildx-action@v3
146+
147+
- name: Log in to GHCR
148+
uses: docker/login-action@v3
149+
with:
150+
registry: ${{ env.REGISTRY }}
151+
username: ${{ github.repository_owner }}
152+
password: ${{ secrets.GITHUB_TOKEN }}
153+
154+
- name: Build and push
155+
uses: docker/build-push-action@v6
156+
with:
157+
context: .
158+
build-args: |
159+
LOCK_FLAG=
160+
platforms: linux/amd64,linux/arm64
161+
push: true
162+
tags: |
163+
${{ env.REGISTRY }}/${{ github.repository }}:dev
164+
cache-from: type=gha
165+
cache-to: type=gha,mode=max
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Stable Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
env:
9+
BIN_NAME: ${{ github.event.repository.name }}
10+
REGISTRY: ghcr.io
11+
12+
permissions:
13+
contents: write
14+
packages: write
15+
16+
jobs:
17+
build-stable:
18+
name: Build ${{ matrix.target }}
19+
runs-on: ${{ matrix.os }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- target: x86_64-unknown-linux-musl
25+
os: ubuntu-latest
26+
install_deps: sudo apt-get update && sudo apt-get install -y musl-tools
27+
- target: x86_64-unknown-linux-gnu
28+
os: ubuntu-latest
29+
install_deps: "false"
30+
- target: aarch64-unknown-linux-musl
31+
os: ubuntu-24.04-arm
32+
install_deps: sudo apt-get update && sudo apt-get install -y musl-tools
33+
- target: aarch64-unknown-linux-gnu
34+
os: ubuntu-24.04-arm
35+
install_deps: "false"
36+
- target: x86_64-apple-darwin
37+
os: macos-15-intel
38+
install_deps: "false"
39+
- target: aarch64-apple-darwin
40+
os: macos-latest
41+
install_deps: "false"
42+
- target: x86_64-pc-windows-msvc
43+
os: windows-latest
44+
install_deps: "false"
45+
- target: aarch64-pc-windows-msvc
46+
os: windows-11-arm
47+
install_deps: "false"
48+
49+
steps:
50+
- name: Checkout
51+
uses: actions/checkout@v6
52+
53+
- name: Install System Dependencies
54+
if: matrix.install_deps != 'false'
55+
run: ${{ matrix.install_deps }}
56+
57+
- name: Install Rust Toolchain
58+
uses: dtolnay/rust-toolchain@master
59+
with:
60+
toolchain: stable
61+
targets: ${{ matrix.target }}
62+
63+
- name: Rust Cache
64+
uses: swatinem/rust-cache@v2
65+
with:
66+
key: ${{ matrix.target }}
67+
68+
- name: Build Binary
69+
run: cargo build --locked --release --target ${{ matrix.target }}
70+
71+
- name: Package Binary
72+
shell: bash
73+
run: |
74+
mkdir dist
75+
cp LICENSE dist/
76+
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
77+
cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}.exe" dist/
78+
cd dist
79+
7z a "../${{ env.BIN_NAME }}-${{ matrix.target }}.zip" "${{ env.BIN_NAME }}.exe" LICENSE
80+
else
81+
cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}" dist/
82+
cd dist
83+
tar -czf "../${{ env.BIN_NAME }}-${{ matrix.target }}.tar.gz" "${{ env.BIN_NAME }}" LICENSE
84+
fi
85+
86+
- name: Upload Artifact
87+
uses: actions/upload-artifact@v6
88+
with:
89+
name: binary-${{ matrix.target }}
90+
path: ${{ env.BIN_NAME }}-${{ matrix.target }}*
91+
retention-days: 1
92+
93+
release-stable:
94+
name: Create Official Release
95+
needs: build-stable
96+
runs-on: ubuntu-latest
97+
steps:
98+
- name: Download Artifacts
99+
uses: actions/download-artifact@v6
100+
with:
101+
path: artifacts
102+
merge-multiple: true
103+
104+
- name: Create Release
105+
uses: softprops/action-gh-release@v2
106+
with:
107+
files: artifacts/*
108+
generate_release_notes: true
109+
make_latest: true
110+
111+
docker-stable:
112+
name: Push Stable Docker
113+
runs-on: ubuntu-latest
114+
steps:
115+
- name: Checkout
116+
uses: actions/checkout@v6
117+
118+
- name: Set up QEMU
119+
uses: docker/setup-qemu-action@v3
120+
121+
- name: Set up Docker Buildx
122+
uses: docker/setup-buildx-action@v3
123+
124+
- name: Log in to GHCR
125+
uses: docker/login-action@v3
126+
with:
127+
registry: ${{ env.REGISTRY }}
128+
username: ${{ github.repository_owner }}
129+
password: ${{ secrets.GITHUB_TOKEN }}
130+
131+
- name: Extract metadata
132+
id: meta
133+
uses: docker/metadata-action@v5
134+
with:
135+
images: ${{ env.REGISTRY }}/${{ github.repository }}
136+
tags: |
137+
type=semver,pattern={{version}}
138+
type=raw,value=latest
139+
140+
- name: Build and push
141+
uses: docker/build-push-action@v6
142+
with:
143+
context: .
144+
platforms: linux/amd64,linux/arm64
145+
push: true
146+
tags: ${{ steps.meta.outputs.tags }}
147+
labels: ${{ steps.meta.outputs.labels }}
148+
cache-from: type=gha
149+
cache-to: type=gha,mode=max
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Trigger Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
semver:
7+
description: "Version Bump Level"
8+
required: true
9+
default: "patch"
10+
type: choice
11+
options:
12+
- patch
13+
- minor
14+
- major
15+
16+
permissions:
17+
contents: write
18+
19+
jobs:
20+
bump:
21+
name: Bump Version
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v6
26+
with:
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Git Config
30+
run: |
31+
git config user.name "github-actions[bot]"
32+
git config user.email "github-actions[bot]@users.noreply.github.com"
33+
34+
- name: Install cargo-edit
35+
uses: taiki-e/install-action@v2
36+
with:
37+
tool: cargo-edit
38+
39+
- name: Bump Version
40+
run: |
41+
cargo set-version --bump ${{ inputs.semver }}
42+
43+
cargo check
44+
45+
NEW_VERSION=$(grep -m1 'version = "' Cargo.toml | cut -d '"' -f 2)
46+
echo "NEW_VERSION=v$NEW_VERSION" >> $GITHUB_ENV
47+
48+
- name: Commit and Push
49+
run: |
50+
git commit -am "chore: release ${{ env.NEW_VERSION }}"
51+
git tag ${{ env.NEW_VERSION }}
52+
git push origin master
53+
git push origin ${{ env.NEW_VERSION }}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/target
2+
3+
/logs
4+
/plugins
5+
.env
6+
config.yaml

0 commit comments

Comments
 (0)