Bump version #92
This file contains 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: Create release | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- 'pyproject.toml' | |
jobs: | |
check-version: | |
name: Check if package version changed | |
runs-on: ubuntu-latest | |
outputs: | |
needs-build: ${{ steps.check.outputs.value }} | |
new-version: ${{ steps.new-version.outputs.value }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "Get previous tag" | |
id: previous_tag | |
uses: "WyriHaximus/[email protected]" | |
with: | |
prefix: "v" | |
fallback: 0.0.0 | |
- name: "Get package version" | |
id: package_version_raw | |
uses: sravinet/[email protected] | |
with: | |
file: "pyproject.toml" | |
field: "tool.poetry.version" | |
# Add a 'v' onto the start of the package version for comparison | |
- id: package_version | |
run: echo "value=v${{steps.package_version_raw.outputs.value}}" >> "$GITHUB_OUTPUT" | |
- id: check | |
run: echo "value=${{ steps.package_version.outputs.value != steps.previous_tag.outputs.tag }}" >> "$GITHUB_OUTPUT" | |
- id: new-version | |
run: echo "value=${{ steps.package_version.outputs.value }}" >> "$GITHUB_OUTPUT" | |
build-appimage: | |
needs: check-version | |
if: ${{ needs.check-version.outputs.needs-build == 'true' }} | |
name: Build Appimage | |
runs-on: ubuntu-22.04 | |
steps: | |
- run: sudo apt install desktop-file-utils -y | |
- uses: actions/checkout@v4 | |
- name: Download appimagetool | |
run: wget https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool | |
- run: chmod +x appimagetool | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2 | |
- name: Install deps | |
run: poetry install --with flatpak-exclude | |
- run: poetry update qcanvas-backend | |
- name: Build pyinstaller | |
run: poetry run pyinstaller --hidden-import aiosqlite --onedir -n AppRun qcanvas/run.py | |
- name: Move files | |
run: mv dist/*/* appimage/ | |
- name: Set version | |
uses: richardrigutins/replace-in-files@v2 | |
with: | |
files: "appimage/qcanvas.desktop" | |
search-text: "#VERSION#" | |
replacement-text: ${{ needs.check-version.outputs.new-version }} | |
- name: Package AppImage | |
run: ./appimagetool appimage -u "gh-releases-zsync|QCanvas|QCanvasApp|latest|QCanvas-x86_64.AppImage.zsync" | |
- name: Create release | |
run: gh release create ${{ needs.check-version.outputs.new-version }} --generate-notes | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Upload binaries | |
if: always() | |
run: gh release upload ${{ needs.check-version.outputs.new-version }} QCanvas-* --clobber | |
env: | |
GH_TOKEN: ${{ github.token }} | |
build-windows: | |
needs: check-version | |
if: ${{ needs.check-version.outputs.needs-build == 'true' }} | |
name: Build PyInstaller Windows | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2 | |
- name: Install deps | |
run: poetry install --with flatpak-exclude | |
- run: poetry update qcanvas-backend | |
- name: Build pyinstaller | |
run: poetry run pyinstaller --hidden-import aiosqlite --onefile -n QCanvas --icon windows/qcanvas.ico qcanvas/run.py --windowed | |
- name: Create release | |
run: gh release create ${{ needs.check-version.outputs.new-version }} --generate-notes | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Upload binaries | |
if: always() | |
run: gh release upload ${{ needs.check-version.outputs.new-version }} dist/QCanvas.exe --clobber | |
env: | |
GH_TOKEN: ${{ github.token }} | |
publish-pypi: | |
needs: check-version | |
if: ${{ needs.check-version.outputs.needs-build == 'true' }} | |
name: Publish PyPI package | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build and publish to pypi | |
uses: JRubics/[email protected] | |
with: | |
pypi_token: ${{ secrets.PYPI_TOKEN }} |