Release #2
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: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: typst-community/setup-typst@v4 | |
| with: | |
| version: 0.13.1 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Extract version from tag | |
| id: ver | |
| run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| - name: Write VERSION file | |
| run: echo "${{ steps.ver.outputs.version }}" > VERSION | |
| - name: Build PDF | |
| run: python build.py | |
| - name: Commit PDF to main | |
| env: | |
| VERSION: ${{ steps.ver.outputs.version }} | |
| run: | | |
| set -euo pipefail | |
| PDF="python-a-abap-v${VERSION}.pdf" | |
| cp "$PDF" "/tmp/${PDF}" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git fetch origin main | |
| git checkout main | |
| git pull --rebase origin main | |
| cp "/tmp/${PDF}" "$PDF" | |
| for old in python-a-abap-v*.pdf; do | |
| if [ -f "$old" ] && [ "$old" != "$PDF" ]; then | |
| git rm -f "$old" || rm -f "$old" | |
| fi | |
| done | |
| git add "$PDF" | |
| if git diff --staged --quiet; then | |
| echo "No PDF changes to commit." | |
| else | |
| git commit -m "Publish PDF v${VERSION}" | |
| git push origin main | |
| fi | |
| - name: Publish GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: python-a-abap-v${{ steps.ver.outputs.version }}.pdf | |
| generate_release_notes: true |