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:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*' # Reagiere auf Tags wie v1.0.0
|
- 'v*' # Nur bei Tags wie v1.0.0
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Enable debug output
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
|
||||||
|
- name: Checkout source
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Go (required for git-chglog)
|
- name: Show environment variables for debugging
|
||||||
uses: actions/setup-go@v4
|
|
||||||
with:
|
|
||||||
go-version: '1.21'
|
|
||||||
|
|
||||||
- name: Install git-chglog
|
|
||||||
run: |
|
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
|
chmod +x git-chglog
|
||||||
sudo mv git-chglog /usr/local/bin/
|
sudo mv git-chglog /usr/local/bin/
|
||||||
|
|
||||||
|
- name: Show git-chglog version
|
||||||
|
run: git-chglog --version
|
||||||
|
|
||||||
- name: Generate CHANGELOG.md for current tag
|
- name: Generate CHANGELOG.md for current tag
|
||||||
run: |
|
run: |
|
||||||
VERSION=$(git describe --tags --abbrev=0)
|
TAG=${GITHUB_REF##*/} # z.B. v1.0.0
|
||||||
git-chglog -o CHANGELOG.md "$VERSION"
|
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: |
|
run: |
|
||||||
echo "REPO=${GITEA_REPOSITORY#*/}" >> $GITEA_ENV
|
TAG=${GITHUB_REF##*/}
|
||||||
echo "OWNER=${GITEA_REPOSITORY%/*}" >> $GITEA_ENV
|
echo "Creating release for tag $TAG in repo $OWNER/$REPO"
|
||||||
|
curl -X POST "https://dev.ksite.de/api/v1/repos/${OWNER}/${REPO}/releases" \
|
||||||
- name: Create Gitea release
|
-H "Content-Type: application/json" \
|
||||||
uses: https://gitea.com/actions/release-action@main
|
-H "Authorization: token $TOKEN" \
|
||||||
with:
|
-d @- <<EOF
|
||||||
api_key: ${{ secrets.TOKEN }}
|
{
|
||||||
owner: ${{ env.OWNER }}
|
"tag_name": "${TAG}",
|
||||||
repo: ${{ env.REPO }}
|
"name": "${TAG}",
|
||||||
tag: ${{ github.ref_name }}
|
"body": "$(sed 's/"/\\"/g' CHANGELOG.md)"
|
||||||
body_file: CHANGELOG.md
|
}
|
||||||
|
EOF
|
||||||
|
Reference in New Issue
Block a user