diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index c8a672b..096dd0c 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -1,44 +1,43 @@ -name: Build Changelog and Release +name: Release on: push: tags: - - 'v*.*.*' + - 'v*' # Reagiere auf Tags wie v1.0.0 jobs: release: runs-on: ubuntu-latest - steps: - - name: Checkout code + - name: Checkout repository 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 run: | - curl -sSL https://github.com/git-chglog/git-chglog/releases/download/v0.15.1/git-chglog_0.15.1_linux_amd64.tar.gz | tar -xz + curl -sSL https://github.com/git-chglog/git-chglog/releases/latest/download/git-chglog_linux_amd64 -o git-chglog + chmod +x git-chglog sudo mv git-chglog /usr/local/bin/ - - name: Generate changelog + - name: Generate CHANGELOG.md for current tag run: | - git-chglog $(git describe --tags --abbrev=0) > RELEASE_NOTES.md + VERSION=$(git describe --tags --abbrev=0) + git-chglog -o CHANGELOG.md "$VERSION" - - name: Create Release on Gitea - env: - GITEA_TOKEN: ${{ secrets.TOKEN }} + - name: Extract repository info run: | - TAG=$(git describe --tags) - REPO=${GITEA_REPOSITORY#*/} - OWNER=${GITEA_REPOSITORY%/*} - BODY=$(cat RELEASE_NOTES.md | jq -Rs .) - - curl -X POST "https://dev.ksite.de/api/v1/repos/ralf.kirchner/demo/releases" \ - -H "Authorization: token $GITEA_TOKEN" \ - -H "Content-Type: application/json" \ - -d "{ - \"tag_name\": \"$TAG\", - \"name\": \"$TAG\", - \"body\": $BODY, - \"draft\": false, - \"prerelease\": false - }" + 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