Skip to content

Commit a7b636d

Browse files
committed
Adds more pre-build releases
1 parent 8ef24b2 commit a7b636d

File tree

3 files changed

+366
-73
lines changed

3 files changed

+366
-73
lines changed

.github/workflows/aur.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: AUR
2+
on:
3+
workflow_run:
4+
workflows: [ "Release" ]
5+
types: [ completed ]
6+
7+
jobs:
8+
pkgbuild:
9+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
10+
runs-on: ubuntu-24.04
11+
container: archlinux:latest
12+
steps:
13+
- name: Prepare Arch toolchain
14+
run: |
15+
pacman -Syu --noconfirm base-devel git fakeroot curl
16+
17+
- uses: actions/checkout@v4
18+
19+
- name: Create builder user
20+
run: |
21+
useradd -m builder
22+
chown -R builder:builder "$GITHUB_WORKSPACE"
23+
24+
- name: Resolve release metadata
25+
id: meta
26+
env:
27+
RUN_HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
28+
RUN_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
29+
run: |
30+
set -euo pipefail
31+
git fetch --force --tags
32+
tag="${RUN_HEAD_BRANCH}"
33+
if [[ -z "$tag" ]]; then
34+
tag="$(git tag --points-at "$RUN_HEAD_SHA" | head -n1)"
35+
fi
36+
if [[ -z "$tag" ]]; then
37+
echo "Unable to determine tag for ${RUN_HEAD_SHA}" >&2
38+
exit 1
39+
fi
40+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
41+
echo "version=${tag#v}" >> "$GITHUB_OUTPUT"
42+
43+
- name: Resolve release checksums
44+
id: sums
45+
env:
46+
REPO: ${{ github.repository }}
47+
TAG: ${{ steps.meta.outputs.tag }}
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
run: |
50+
set -euo pipefail
51+
while IFS=':' read -r arch target; do
52+
asset="prmt-${target}.tar.gz.sha256"
53+
url="https://github.com/${REPO}/releases/download/${TAG}/${asset}"
54+
checksum="$(curl -sSfL -H "Authorization: Bearer ${GITHUB_TOKEN}" "$url" | awk '{print $1}')"
55+
echo "sha256_${arch}=${checksum}" >> "$GITHUB_OUTPUT"
56+
done <<'EOF'
57+
x86_64:x86_64-unknown-linux-musl
58+
aarch64:aarch64-unknown-linux-musl
59+
armv7h:armv7-unknown-linux-musleabihf
60+
EOF
61+
62+
- name: Generate PKGBUILD and .SRCINFO
63+
env:
64+
VERSION: ${{ steps.meta.outputs.version }}
65+
SHA256_X86_64: ${{ steps.sums.outputs.sha256_x86_64 }}
66+
SHA256_AARCH64: ${{ steps.sums.outputs.sha256_aarch64 }}
67+
SHA256_ARMV7H: ${{ steps.sums.outputs.sha256_armv7h }}
68+
run: |
69+
set -euo pipefail
70+
cat > PKGBUILD <<EOF
71+
pkgname=prmt-bin
72+
pkgver=${VERSION}
73+
pkgrel=1
74+
pkgdesc='Ultra-fast customizable shell prompt (single Rust binary)'
75+
arch=('x86_64' 'aarch64' 'armv7h')
76+
url='https://github.com/3axap4eHko/prmt'
77+
license=('MIT')
78+
provides=('prmt')
79+
conflicts=('prmt')
80+
source_x86_64=("https://github.com/3axap4eHko/prmt/releases/download/v${VERSION}/prmt-x86_64-unknown-linux-musl.tar.gz")
81+
source_aarch64=("https://github.com/3axap4eHko/prmt/releases/download/v${VERSION}/prmt-aarch64-unknown-linux-musl.tar.gz")
82+
source_armv7h=("https://github.com/3axap4eHko/prmt/releases/download/v${VERSION}/prmt-armv7-unknown-linux-musleabihf.tar.gz")
83+
sha256sums_x86_64=('${SHA256_X86_64}')
84+
sha256sums_aarch64=('${SHA256_AARCH64}')
85+
sha256sums_armv7h=('${SHA256_ARMV7H}')
86+
package() {
87+
tar -xzf prmt-*.tar.gz
88+
install -Dm755 prmt*/prmt "$pkgdir/usr/bin/prmt"
89+
install -Dm644 prmt*/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
90+
}
91+
EOF
92+
chown builder:builder PKGBUILD
93+
runuser -u builder -- bash -c '
94+
set -euo pipefail
95+
cd "$GITHUB_WORKSPACE"
96+
makepkg --printsrcinfo > .SRCINFO
97+
'
98+
99+
- uses: actions/upload-artifact@v4
100+
with:
101+
name: aur
102+
path: |
103+
PKGBUILD
104+
.SRCINFO

.github/workflows/openwrt.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: OpenWrt
2+
on:
3+
workflow_run:
4+
workflows: [ "Release" ]
5+
types: [ completed ]
6+
7+
jobs:
8+
ipk:
9+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
10+
runs-on: ubuntu-24.04
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
include:
15+
- { arch: x86_64, target: x86_64-unknown-linux-musl, sdk: ghcr.io/openwrt/sdk:x86_64-musl }
16+
- { arch: aarch64_cortex-a53, target: aarch64-unknown-linux-musl, sdk: ghcr.io/openwrt/sdk:armvirt-64-musl }
17+
- { arch: arm_cortex-a7, target: armv7-unknown-linux-musleabihf, sdk: ghcr.io/openwrt/sdk:arm-cortex-a7_neon-vfpv4-musl }
18+
container:
19+
image: ${{ matrix.sdk }}
20+
options: --user root
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Resolve release metadata
25+
id: meta
26+
env:
27+
RUN_HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
28+
RUN_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
29+
run: |
30+
set -euo pipefail
31+
git fetch --force --tags
32+
tag="${RUN_HEAD_BRANCH}"
33+
if [[ -z "$tag" ]]; then
34+
tag="$(git tag --points-at "$RUN_HEAD_SHA" | head -n1)"
35+
fi
36+
if [[ -z "$tag" ]]; then
37+
echo "Unable to determine tag for ${RUN_HEAD_SHA}" >&2
38+
exit 1
39+
fi
40+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
41+
echo "version=${tag#v}" >> "$GITHUB_OUTPUT"
42+
43+
- name: Download and verify release archive
44+
env:
45+
TAG: ${{ steps.meta.outputs.tag }}
46+
REPO: ${{ github.repository }}
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
run: |
49+
set -euxo pipefail
50+
mkdir -p /work && cd /work
51+
file="prmt-${{ matrix.target }}.tar.gz"
52+
curl -sSfL -H "Authorization: Bearer ${GITHUB_TOKEN}" -o "$file" \
53+
"https://github.com/${REPO}/releases/download/${TAG}/$file"
54+
curl -sSfL -H "Authorization: Bearer ${GITHUB_TOKEN}" -o "${file}.sha256" \
55+
"https://github.com/${REPO}/releases/download/${TAG}/${file}.sha256"
56+
sha256sum -c "${file}.sha256"
57+
tar -xzf "$file" -C /work
58+
59+
- name: Build .ipk
60+
env:
61+
TAG: ${{ steps.meta.outputs.tag }}
62+
VERSION: ${{ steps.meta.outputs.version }}
63+
REPO: ${{ github.repository }}
64+
ARCH: ${{ matrix.arch }}
65+
run: |
66+
set -euxo pipefail
67+
cd /work
68+
d=$(find . -maxdepth 1 -type d -name 'prmt-*' | head -n1)
69+
test -n "$d"
70+
install -Dm755 "$d/prmt" ./pkg/usr/bin/prmt
71+
install -Dm644 "$d/LICENSE" ./pkg/usr/share/licenses/prmt/LICENSE
72+
73+
mkdir -p ./pkg/CONTROL
74+
{
75+
printf 'Package: prmt\n'
76+
printf 'Version: %s\n' "$VERSION"
77+
printf 'Architecture: %s\n' "$ARCH"
78+
printf 'Section: utils\n'
79+
printf 'Priority: optional\n'
80+
printf 'Depends:\n'
81+
printf 'Source: https://github.com/%s\n' "$REPO"
82+
printf 'Description: Ultra-fast customizable shell prompt (static Rust binary)\n'
83+
} > ./pkg/CONTROL/control
84+
85+
ipkg-build -o root -g root ./pkg
86+
mkdir -p /out
87+
mv *.ipk /out/
88+
89+
- uses: actions/upload-artifact@v4
90+
with:
91+
name: openwrt-${{ matrix.arch }}
92+
path: |
93+
/out/*.ipk

0 commit comments

Comments
 (0)