All checks were successful
Create Release PR / Create Release PR (push) Successful in 17s
61 lines
2.0 KiB
YAML
61 lines
2.0 KiB
YAML
name: Create Release
|
|
on:
|
|
pull_request:
|
|
types: [closed]
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
publish-release:
|
|
name: Publish Release
|
|
if: gitea.event_name == 'pull_request' && gitea.event.pull_request.merged == true && startsWith(gitea.event.pull_request.head.ref, 'release-please')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GT_TOKEN }}
|
|
|
|
- name: Get version
|
|
id: version
|
|
run: |
|
|
VERSION=$(jq -r '."."' .release-please-manifest.json)
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create Git Tag
|
|
env:
|
|
GIT_TOKEN: ${{ secrets.GT_TOKEN }}
|
|
run: |
|
|
git config user.name "Gitea Actions"
|
|
git config user.email "actions@git.tdpi.dev"
|
|
git tag -a "v${{ steps.version.outputs.version }}" -m "Release v${{ steps.version.outputs.version }}"
|
|
git push https://x-access-token:${GIT_TOKEN}@git.tdpi.dev/TDPI/jellyfin-plugin-smartnotify.git "v${{ steps.version.outputs.version }}"
|
|
|
|
- name: Create Release
|
|
env:
|
|
GIT_TOKEN: ${{ secrets.GT_TOKEN }}
|
|
VERSION: ${{ steps.version.outputs.version }}
|
|
run: |
|
|
CHANGELOG=$(awk '/^## '"$VERSION"'/{flag=1} /^## / && flag && !/^## '"$VERSION"'/{exit} flag' CHANGELOG.md)
|
|
|
|
PAYLOAD=$(jq -n \
|
|
--arg tag "v$VERSION" \
|
|
--arg name "v$VERSION" \
|
|
--arg body "$CHANGELOG" \
|
|
'{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: false}')
|
|
|
|
curl -X POST "https://git.tdpi.dev/api/v1/repos/TDPI/jellyfin-plugin-smartnotify/releases" \
|
|
-H "Authorization: token $GIT_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d "$PAYLOAD"
|
|
|
|
- name: Cleanup Release Branch
|
|
env:
|
|
GIT_TOKEN: ${{ secrets.GT_TOKEN }}
|
|
run: |
|
|
git push --delete origin release-please--branches--main || true
|