luminate-old/.forgejo/workflows/release.yml
Brendan Szymanski bb28ae790a
All checks were successful
PR Checks / lint (pull_request) Successful in 59s
PR Checks / flatpak-build (pull_request) Successful in 13m21s
Remove tests
2026-06-22 13:23:31 -04:00

60 lines
2.2 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: docker
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-50
options: --privileged
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: https://github.com/flatpak/flatpak-github-actions/flatpak-builder@v6.7
with:
manifest-path: dev.bscubed.Luminate.json
bundle: Luminate.flatpak
cache-key: flatpak-builder-${arch}-${sha256(dev.bscubed.Luminate.json)}-release
branch: stable
repository-url: https://flathub.org/repo/flathub.flatpakrepo
upload-artifact: false
- name: Install tools
run: apt-get update -qq && apt-get install -y -qq jq
- name: Generate changelog
run: |
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
if [ -n "$PREV_TAG" ]; then
git log --oneline --no-decorate "$PREV_TAG..HEAD" > /tmp/changelog.md
else
echo "Initial release" > /tmp/changelog.md
fi
- name: Create Forgejo release
env:
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
run: |
TAG="${{ forge.ref_name }}"
REPO="${{ forge.repository }}"
API_URL="${{ forge.api_url }}"
jq -n --arg tag "$TAG" --rawfile body /tmp/changelog.md \
'{tag_name: $tag, name: $tag, body: $body}' > /tmp/release-payload.json
RESPONSE=$(curl -s -X POST \
-H "Authorization: token $FORGEJO_TOKEN" \
-H "Content-Type: application/json" \
-d @/tmp/release-payload.json \
"$API_URL/repos/$REPO/releases")
RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id')
if [ "$RELEASE_ID" = "null" ] || [ -z "$RELEASE_ID" ]; then
echo "Failed to create release:"
echo "$RESPONSE"
exit 1
fi
curl -s -X POST \
-H "Authorization: token $FORGEJO_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary "@Luminate.flatpak" \
"$API_URL/repos/$REPO/releases/$RELEASE_ID/assets?name=Luminate-$TAG.flatpak"