name: Auto Release on: workflow_call: jobs: auto-release: runs-on: ubuntu-latest steps: - name: Checkout uses: https://gitea.com/actions/checkout@v4 with: fetch-depth: 0 - name: Generate changelog id: changelog run: | CURRENT_TAG=${GITHUB_REF#refs/tags/} PREV_TAG=$(git tag --sort=-version:refname | sed -n '2p') if [ -z "$PREV_TAG" ]; then CHANGELOG=$(git log --pretty=format:"- %s (%h)" "$CURRENT_TAG") else CHANGELOG=$(git log --pretty=format:"- %s (%h)" "${PREV_TAG}..${CURRENT_TAG}") fi echo "$CHANGELOG" > changelog.txt echo "current_tag=$CURRENT_TAG" >> $GITHUB_OUTPUT - name: Create release env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} run: | CURRENT_TAG=${{ steps.changelog.outputs.current_tag }} APP_NAME=$(jq -r '.name' package.json) CHANGELOG=$(cat changelog.txt) curl -s -X POST \ -H "Content-Type: application/json" \ -H "Authorization: token $GITEA_TOKEN" \ "https://gitea.pzetatouch.it/api/v1/repos/${{ gitea.repository }}/releases" \ -d "{ \"tag_name\": \"$CURRENT_TAG\", \"name\": \"$APP_NAME $CURRENT_TAG\", \"body\": $(echo "$CHANGELOG" | jq -Rs .), \"draft\": false, \"prerelease\": false }"