diff --git a/.gitea/workflows/release-with-tag.yaml b/.gitea/workflows/release-with-tag.yaml new file mode 100644 index 0000000..42b1adc --- /dev/null +++ b/.gitea/workflows/release-with-tag.yaml @@ -0,0 +1,67 @@ +name: Get Changelog +on: + workflow_call: + outputs: + tag_name: + description: "Tag name" + value: ${{ jobs.get_next_release.outputs.release_name }} + changelog: + description: "Changelog" + value: ${{ jobs.get_next_release.outputs.clean_changelog }} + +jobs: + get_next_release: + name: Get Next Release + runs-on: ubuntu-latest + outputs: + release_name: ${{ steps.get_next_version.outputs.tag }} + # changelog: ${{ steps.get_next_version.outputs.changelog }} + clean_changelog: ${{ steps.get_next_version.outputs.clean_changelog }} + steps: + - name: Check out repository + uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + + - name: Changes since last tag + id: changes + run: | + rm -f .changes + git log $(git describe --tags --abbrev=0)..HEAD --no-merges --oneline >> .changes + cat .changes + + - name: Check for changes + run: | + if [[ -z $(grep '[^[:space:]]' .changes) ]] ; then + echo "changes=false" + echo "changes=false" >> "$GITEA_OUTPUT" + else + echo "changes=true" + echo "changes=true" >> "$GITEA_OUTPUT" + fi + + - name: Cancel if no changes + if: steps.changes.outputs.changes == 'false' + run: exit 1 + + - name: Set server URL + id: set_srvurl + run: | + SRVURL=$(echo "${{ gitea.server_url }}" | sed 's/https:\/\/\(.*\)/\1/') + echo "srvurl=$SRVURL" >> "$GITEA_OUTPUT" + + - name: Get next version + uses: TriPSs/conventional-changelog-action@v6 + id: get_next_version + with: + git-url: ${{ steps.set_srvurl.outputs.srvurl }} + github-token: ${{ gitea.token }} + preset: "conventionalcommits" + # preset: "angular" # This is the default + skip-commit: true + release-count: 1 + output-file: false + create-summary: true + skip-on-empty: true + skip-version-file: true + skip-tag: false