Merge release/v0.2.4: self-updating app, diacritic and repair fixes, … #8
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 | |
| # Tag the release and this publishes it. The in-app update check reads the | |
| # latest tag from this repository, so the tag and the asset name have to be | |
| # right every time - which is exactly the kind of thing manual uploads get | |
| # wrong once and then nobody notices for a month. | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Check the tag matches APP_VERSION | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| shell: pwsh | |
| run: | | |
| $tag = "${{ github.ref_name }}".TrimStart("v") | |
| $line = Select-String -Path app/update.py -Pattern '^APP_VERSION = "(.+)"$' | |
| $version = $line.Matches[0].Groups[1].Value | |
| if ($tag -ne $version) { | |
| throw "Tag $tag does not match APP_VERSION $version in app/update.py" | |
| } | |
| Write-Host "Releasing $version" | |
| # build.ps1 requires a virtual environment at the repository root and | |
| # installs the dependencies into it itself. | |
| - name: Create the virtual environment | |
| run: python -m venv .venv | |
| - name: Build | |
| run: .\build.ps1 | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: PDFTranslate-windows | |
| path: dist/PDFTranslate-windows.zip | |
| if-no-files-found: error | |
| macos: | |
| name: macOS (${{ matrix.arch }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: apple-silicon | |
| runner: macos-15 | |
| - arch: intel | |
| runner: macos-15-intel | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Check the tag matches APP_VERSION | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| shell: bash | |
| run: | | |
| tag="${GITHUB_REF_NAME#v}" | |
| version="$(sed -n 's/^APP_VERSION = "\([^"]*\)"$/\1/p' app/update.py)" | |
| if [[ "$tag" != "$version" ]]; then | |
| echo "Tag $tag does not match APP_VERSION $version in app/update.py" >&2 | |
| exit 1 | |
| fi | |
| echo "Releasing $version" | |
| - name: Build app and DMG | |
| shell: bash | |
| run: bash build-macos.sh | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: PDFTranslate-macos-${{ matrix.arch }} | |
| path: dist/PDFTranslate-macos-${{ matrix.arch }}.dmg | |
| if-no-files-found: error | |
| publish: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [windows, macos] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v7 | |
| with: | |
| path: release-assets | |
| merge-multiple: true | |
| - uses: softprops/action-gh-release@v3 | |
| with: | |
| files: release-assets/* | |
| generate_release_notes: true |