gha-workflows/.gitea/workflows/create-release.yml

84 lines
2.4 KiB
YAML
Raw Normal View History

2025-01-12 18:14:21 +00:00
name: Release
on:
workflow_call:
secrets:
ACTIONS_TOKEN:
required: true
outputs:
release_name:
description: "Name of the created release"
2025-01-12 20:47:55 +01:00
value: ${{ jobs.get_next_release.outputs.release_name }}
jobs:
2025-01-12 19:43:19 +00:00
get_next_release:
name: Get Next Release
runs-on: ubuntu-latest
outputs:
2025-01-12 18:14:21 +00:00
release_name: ${{ steps.get_next_version.outputs.tag }}
2025-01-12 19:43:19 +00:00
changelog: ${{ steps.get_next_version.outputs.changelog }}
steps:
2025-01-12 18:14:21 +00:00
- name: Check out repository
uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
- name: Changes since last tag
id: changes
run: |
2025-01-12 18:14:21 +00:00
rm -f .changes
git log $(git describe --tags --abbrev=0)..HEAD --no-merges --oneline >> .changes
cat .changes
2025-01-12 18:14:21 +00:00
- 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"
2025-01-12 18:14:21 +00:00
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/')
2025-01-12 18:14:21 +00:00
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 }}
2025-01-12 18:14:21 +00:00
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: true
2025-01-12 19:43:19 +00:00
create_release:
name: Create Release
runs-on: ubuntu-latest
needs: get_next_release
steps:
- name: Check out repository
uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
- name: Create release
uses: https://git.tainton.uk/actions/create-release-action@v1.1.0
2025-01-12 19:43:19 +00:00
with:
release_name: ${{ needs.get_next_release.outputs.release_name }}
tag: ${{ needs.get_next_release.outputs.release_name }}
body: ${{ needs.get_next_release.outputs.changelog }}