feat: add gdu static musl build + generalize publish_release.py
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
name: gdu static musl build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- .gitea/workflows/gdu.yml
|
||||
- scripts/build_gdu.sh
|
||||
- versions/gdu.version
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build-and-release:
|
||||
runs-on: alpine-latest
|
||||
|
||||
steps:
|
||||
- name: Bootstrap workspace
|
||||
shell: sh
|
||||
env:
|
||||
REPO_URL: ${{ gitea.server_url }}
|
||||
REPO_NAME: ${{ gitea.repository }}
|
||||
GIT_SHA: ${{ gitea.sha }}
|
||||
run: |
|
||||
apk add --no-cache git
|
||||
workdir="$(pwd)"
|
||||
tmpdir="$(mktemp -d)"
|
||||
git clone --depth 1 "$REPO_URL/$REPO_NAME.git" "$tmpdir/repo"
|
||||
git -C "$tmpdir/repo" fetch --depth 1 origin "$GIT_SHA"
|
||||
git -C "$tmpdir/repo" checkout "$GIT_SHA"
|
||||
find "$workdir" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
|
||||
cp -a "$tmpdir/repo"/. "$workdir"/
|
||||
|
||||
- name: Read version
|
||||
id: meta
|
||||
shell: sh
|
||||
working-directory: ${{ gitea.workspace }}
|
||||
run: |
|
||||
version="$(tr -d ' \n\r' < versions/gdu.version)"
|
||||
artifact="gdu-${version}-linux-amd64-musl-static"
|
||||
echo "version=${version}" >> "$GITHUB_OUTPUT"
|
||||
echo "artifact=${artifact}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build static gdu
|
||||
shell: sh
|
||||
working-directory: ${{ gitea.workspace }}
|
||||
run: |
|
||||
chmod +x scripts/build_gdu.sh
|
||||
./scripts/build_gdu.sh "${{ steps.meta.outputs.version }}" "$PWD/dist"
|
||||
|
||||
- name: Publish release assets
|
||||
shell: sh
|
||||
env:
|
||||
GITEA_TOKEN: ${{ gitea.token }}
|
||||
GITEA_API_URL: ${{ gitea.api_url }}
|
||||
REPO_OWNER: ${{ gitea.repository_owner }}
|
||||
REPO_NAME: static-musl-builds
|
||||
TOOL: gdu
|
||||
VERSION: ${{ steps.meta.outputs.version }}
|
||||
TARGET_SHA: ${{ gitea.sha }}
|
||||
working-directory: ${{ gitea.workspace }}
|
||||
run: |
|
||||
python3 scripts/publish_release.py \
|
||||
"dist/${{ steps.meta.outputs.artifact }}" \
|
||||
"dist/${{ steps.meta.outputs.artifact }}.tar.gz" \
|
||||
"dist/${{ steps.meta.outputs.artifact }}.sha256"
|
||||
@@ -59,6 +59,7 @@ jobs:
|
||||
GITEA_API_URL: ${{ gitea.api_url }}
|
||||
REPO_OWNER: ${{ gitea.repository_owner }}
|
||||
REPO_NAME: static-musl-builds
|
||||
TOOL: iperf3
|
||||
VERSION: ${{ steps.meta.outputs.version }}
|
||||
TARGET_SHA: ${{ gitea.sha }}
|
||||
working-directory: ${{ gitea.workspace }}
|
||||
|
||||
Reference in New Issue
Block a user