Add Forgejo Actions workflow to create releases for manwhere binary
All checks were successful
Create Release / release (push) Successful in 3s
All checks were successful
Create Release / release (push) Successful in 3s
This commit is contained in:
parent
8751985370
commit
1ab8ef92ef
3 changed files with 55 additions and 1 deletions
54
.github/workflows/release.yml
vendored
Normal file
54
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
---
|
||||
name: Create Release
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'manwhere'
|
||||
- '.github/workflows/release.yml'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- 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: Create Release
|
||||
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"
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -8,7 +8,7 @@ poertry
|
|||
|
||||
# Zig build artifacts
|
||||
.zig-cache/
|
||||
.zig-out/
|
||||
zig-out/
|
||||
|
||||
# Other build artifacts
|
||||
*.o
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in a new issue