63 lines
1.9 KiB
YAML
63 lines
1.9 KiB
YAML
name: Create Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*' # Startet nur bei Tags wie v1.0.0
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Enable debug output
|
|
run: |
|
|
set -x
|
|
|
|
- name: Checkout source
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Extract repository info
|
|
run: |
|
|
echo "REPO=${GITEA_REPOSITORY#*/}" >> $GITEA_ENV
|
|
echo "OWNER=${GITEA_REPOSITORY%/*}" >> $GITEA_ENV
|
|
|
|
- name: Install git-chglog (no Go needed)
|
|
run: |
|
|
GIT_CHGLOG_VERSION="0.15.1"
|
|
curl -sSL "https://github.com/git-chglog/git-chglog/releases/download/v${GIT_CHGLOG_VERSION}/git-chglog_${GIT_CHGLOG_VERSION}_linux_amd64.tar.gz" -o git-chglog.tar.gz
|
|
tar -xzf git-chglog.tar.gz
|
|
chmod +x git-chglog
|
|
sudo mv git-chglog /usr/local/bin/
|
|
|
|
- name: Show git-chglog version
|
|
run: git-chglog --version
|
|
|
|
- name: Generate CHANGELOG.md for current tag
|
|
run: |
|
|
TAG=$(git describe --tags --abbrev=0)
|
|
echo "Generating changelog for tag: $TAG"
|
|
git-chglog -o CHANGELOG.md "$TAG"
|
|
echo "Changelog generated:"
|
|
cat CHANGELOG.md
|
|
|
|
- name: Create Gitea Release via API (no Go required)
|
|
env:
|
|
TOKEN: ${{ secrets.TOKEN }}
|
|
GITEA_REPOSITORY: ${{ env.GITEA_REPOSITORY }}
|
|
run: |
|
|
OWNER="${GITEA_REPOSITORY%%/*}"
|
|
REPO="${GITEA_REPOSITORY##*/}"
|
|
TAG=${GITHUB_REF##*/} # aktueller Tagname
|
|
echo "Owner: $OWNER, Repo: $REPO, Tag: $TAG"
|
|
curl -X POST "https://your.gitea.instance/api/v1/repos/${OWNER}/${REPO}/releases" \
|
|
-H "Content-Type: application/json" \
|
|
-H "Authorization: token $TOKEN" \
|
|
-d @- <<EOF
|
|
{
|
|
"tag_name": "${TAG}",
|
|
"name": "${TAG}",
|
|
"body": "$(sed 's/"/\\"/g' CHANGELOG.md)"
|
|
}
|
|
EOF
|