Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
406fe1185b | |||
c1acb90180 | |||
8f88f5ac4c | |||
0391802f1b | |||
f642eb5b06 | |||
75f0bc3fef | |||
2cbfeaf6c1 | |||
22a2476194 | |||
342bb23a8a | |||
5d8e00c396 |
@ -1,43 +1,73 @@
|
||||
name: Release
|
||||
name: Create Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*' # Reagiere auf Tags wie v1.0.0
|
||||
- 'v*' # Nur bei Tags wie v1.0.0
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
- name: Enable debug output
|
||||
run: |
|
||||
set -x
|
||||
|
||||
- name: Checkout source
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go (required for git-chglog)
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.21'
|
||||
|
||||
- name: Install git-chglog
|
||||
- name: Show environment variables for debugging
|
||||
run: |
|
||||
curl -sSL https://github.com/git-chglog/git-chglog/releases/latest/download/git-chglog_linux_amd64 -o git-chglog
|
||||
echo "GIT_REMOTE_URL=$(git config --get remote.origin.url)"
|
||||
echo "GITHUB_REF=$GITHUB_REF"
|
||||
|
||||
- name: Extract OWNER and REPO from git remote URL
|
||||
id: repo-info
|
||||
run: |
|
||||
REMOTE_URL=$(git config --get remote.origin.url)
|
||||
echo "Remote URL: $REMOTE_URL"
|
||||
|
||||
OWNER=$(echo "$REMOTE_URL" | sed -E 's#.*/([^/]+)/([^/]+)(\.git)?#\1#')
|
||||
REPO=$(echo "$REMOTE_URL" | sed -E 's#.*/([^/]+)/([^/]+)(\.git)?#\2#')
|
||||
|
||||
echo "OWNER=$OWNER" >> $GITHUB_ENV
|
||||
echo "REPO=$REPO" >> $GITHUB_ENV
|
||||
|
||||
- name: Install git-chglog binary (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: |
|
||||
VERSION=$(git describe --tags --abbrev=0)
|
||||
git-chglog -o CHANGELOG.md "$VERSION"
|
||||
TAG=${GITHUB_REF##*/} # z.B. v1.0.0
|
||||
echo "Generating changelog for tag: $TAG"
|
||||
git-chglog -o CHANGELOG.md "$TAG"
|
||||
echo "Changelog generated:"
|
||||
cat CHANGELOG.md
|
||||
|
||||
- name: Extract repository info
|
||||
- name: Create Gitea Release via API (no Go required)
|
||||
env:
|
||||
TOKEN: ${{ secrets.TOKEN }}
|
||||
OWNER: ${{ env.OWNER }}
|
||||
REPO: ${{ env.REPO }}
|
||||
run: |
|
||||
echo "REPO=${GITEA_REPOSITORY#*/}" >> $GITEA_ENV
|
||||
echo "OWNER=${GITEA_REPOSITORY%/*}" >> $GITEA_ENV
|
||||
|
||||
- name: Create Gitea release
|
||||
uses: https://gitea.com/actions/release-action@main
|
||||
with:
|
||||
api_key: ${{ secrets.TOKEN }}
|
||||
owner: ${{ env.OWNER }}
|
||||
repo: ${{ env.REPO }}
|
||||
tag: ${{ github.ref_name }}
|
||||
body_file: CHANGELOG.md
|
||||
TAG=${GITHUB_REF##*/}
|
||||
echo "Creating release for tag $TAG in repo $OWNER/$REPO"
|
||||
curl -X POST "https://dev.ksite.de/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
|
||||
|
Reference in New Issue
Block a user