feat(ci): add release workflow for .deb and static binary
Add Forgejo Actions workflow that builds and publishes releases: - Triggers on tag push (v*) or manual workflow dispatch - Builds static binary using musl target - Creates .deb package with shell completions - Uploads artifacts to Forgejo Releases Requires RELEASE_TOKEN secret to be configured in repository settings.
This commit is contained in:
parent
10728a554f
commit
0d929b20b7
1 changed files with 82 additions and 0 deletions
82
.forgejo/workflows/release.yml
Normal file
82
.forgejo/workflows/release.yml
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Build and Release
|
||||
runs-on: nix
|
||||
|
||||
steps:
|
||||
- name: Check out Repository
|
||||
uses: https://git.konstantinfickel.de/actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Extract version and handle tagging
|
||||
id: version
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
# Manual trigger: read version from Cargo.toml
|
||||
VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
|
||||
TAG="v${VERSION}"
|
||||
|
||||
# Check if tag already exists
|
||||
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||
echo "::error::Version ${VERSION} is already released"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create and push the tag
|
||||
git tag "$TAG"
|
||||
git push origin "$TAG"
|
||||
|
||||
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "TAG=${TAG}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
# Tag push trigger: extract version from tag
|
||||
VERSION="${GITHUB_REF_NAME#v}"
|
||||
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "TAG=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Build .deb package
|
||||
run: nix build .#streamd-deb -o result-deb
|
||||
|
||||
- name: Build static binary
|
||||
run: nix build .#streamd-musl -o result-musl
|
||||
|
||||
- name: Prepare release artifacts
|
||||
run: |
|
||||
mkdir -p release
|
||||
cp result-deb release/streamd_${{ steps.version.outputs.VERSION }}_amd64.deb
|
||||
cp result-musl/bin/streamd release/streamd-${{ steps.version.outputs.VERSION }}-linux-x86_64
|
||||
|
||||
- name: Create release
|
||||
uses: https://code.forgejo.org/actions/forgejo-release@v2
|
||||
with:
|
||||
direction: upload
|
||||
url: https://git.konstantinfickel.de
|
||||
repo: kfickel/streamd
|
||||
token: ${{ secrets.RELEASE_TOKEN }}
|
||||
tag: ${{ steps.version.outputs.TAG }}
|
||||
release-dir: release
|
||||
release-notes: |
|
||||
## streamd ${{ steps.version.outputs.VERSION }}
|
||||
|
||||
### Debian/Ubuntu
|
||||
```bash
|
||||
wget <release-url>/streamd_${{ steps.version.outputs.VERSION }}_amd64.deb
|
||||
sudo dpkg -i streamd_${{ steps.version.outputs.VERSION }}_amd64.deb
|
||||
```
|
||||
|
||||
### Static binary
|
||||
```bash
|
||||
wget <release-url>/streamd-${{ steps.version.outputs.VERSION }}-linux-x86_64
|
||||
chmod +x streamd-*-linux-x86_64
|
||||
sudo mv streamd-*-linux-x86_64 /usr/local/bin/streamd
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue