Move manwhere release workflow to submodule

This commit is contained in:
Jeremie Fraeys 2026-02-10 18:13:25 -05:00
parent 50244b7eb9
commit a648dc5fd7
No known key found for this signature in database
2 changed files with 1 additions and 97 deletions

View file

@ -1,96 +0,0 @@
---
name: Create Release
on:
push:
branches:
- main
paths:
- 'manwhere'
- '.github/workflows/release.yml'
jobs:
release:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Zig
run: |
if ! command -v zig &> /dev/null; then
ZIG_VERSION=$(curl -s "https://api.github.com/repos/ziglang/zig/releases/latest" | grep -Po '"tag_name": "\K[0-9.]+')
wget -qO zig.tar.xz https://ziglang.org/download/${ZIG_VERSION}/zig-x86_64-linux-${ZIG_VERSION}.tar.xz
sudo mkdir -p /opt/zig
sudo tar xf zig.tar.xz --strip-components=1 -C /opt/zig
sudo ln -s /opt/zig/zig /usr/local/bin/zig
rm -f zig.tar.xz
fi
zig version
- name: Run tests
run: |
cd scripts/manwhere && zig build test
- name: Get version from commit
id: version
run: |
VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "v0.1.0-$(git rev-parse --short HEAD)")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Check if version changed
id: check_version
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.version }}"
# Get latest release tag
LATEST_RELEASE=$(curl -s -H "Authorization: token $GITEA_TOKEN" \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/latest" | jq -r '.tag_name // empty')
echo "Latest release: $LATEST_RELEASE"
echo "Current version: $VERSION"
if [ "$LATEST_RELEASE" = "$VERSION" ]; then
echo "Version unchanged, skipping release"
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "Version changed, creating release"
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Create Release
if: steps.check_version.outputs.changed == 'true'
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.version }}"
# Delete existing release with same tag if exists
curl -s -X DELETE \
-H "Authorization: token $GITEA_TOKEN" \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/tags/$VERSION" || true
# Create new release
curl -s -X POST \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d "{
\"tag_name\": \"$VERSION\",
\"name\": \"manwhere $VERSION\",
\"body\": \"Release of manwhere binary\\n\\nBuilt from commit: ${{ github.sha }}\",
\"target_commitish\": \"main\"
}" \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases" | tee release.json
RELEASE_ID=$(jq -r '.id' release.json)
# Upload binary
curl -s -X POST \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary @manwhere \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/$RELEASE_ID/assets?name=manwhere&attachment=true"
echo "Release created: ${{ github.server_url }}/${{ github.repository }}/releases/tag/$VERSION"

@ -1 +1 @@
Subproject commit 26eb50d38f31ad0f791242e84481f57c4d2326e9
Subproject commit 1d113eacf7be30e7b2b4d0f39c312fbcd45c16bd