Add support to create pre-releases with a generated changelog #37
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: pre-release | |
| on: | |
| push: | |
| tags: [ "[0-9]+.[0-9]+.[0-9]+*" ] | |
| jobs: | |
| create-pre-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@main | |
| with: | |
| version: 1.0.0-pre1 | |
| - name: Use cargo cache | |
| id: cache-cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo | |
| key: gh-release-${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} | |
| restore-keys: gh-release-${{ runner.os }}-cargo- | |
| - name: Install git-cliff | |
| if: steps.cache-cargo.outputs.cache-hit != 'true' | |
| run: | | |
| cargo install git-cliff | |
| - name: Get the Git tag name | |
| id: get-tag-name | |
| run: echo "tag-name=${GITHUB_REF/refs\/tags\//}" | tee -a "$GITHUB_OUTPUT" | |
| - id: release | |
| name: Create changelog and release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gl-gh-release create \ | |
| --repo "python-gardenlinux-lib" \ | |
| --tag "${{ steps.get-tag-name.outputs.tag-name }}" \ | |
| --commit "${{ github.sha }}" \ | |
| --name 'python-gardenlinux-lib v${{ steps.get-tag-name.outputs.tag-name }}' \ | |
| --body " | |
| Changes for v${{ steps.get-tag-name.outputs.tag-name }} | |
| $(git-cliff -o - --github-repo "${{ github.repository }}" --current) | |
| " |