Resolve merge conflict #23
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" | |
create-release: | |
needs: check-version | |
if: ${{ needs.check-version.outputs.needs-build == 'true' }} | |
name: Create release | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create release | |
run: gh release create ${{ needs.check-version.outputs.new-version }} --generate-notes | |
env: | |
GH_TOKEN: ${{ github.token }} | |
build-appimage: | |
needs: [ create-release, check-version ] | |
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/*/* deploy/appimage/ | |
- name: Set version | |
uses: richardrigutins/replace-in-files@v2 | |
with: | |
files: "deploy/appimage/qcanvas.desktop" | |
search-text: "#VERSION#" | |
replacement-text: ${{ needs.check-version.outputs.new-version }} | |
- name: Package AppImage | |
run: ./appimagetool deploy/appimage -u "gh-releases-zsync|QCanvas|QCanvasApp|latest|QCanvas-x86_64.AppImage.zsync" | |
- name: Upload binaries | |
run: gh release upload ${{ needs.check-version.outputs.new-version }} QCanvas-* --clobber | |
env: | |
GH_TOKEN: ${{ github.token }} | |
build-windows: | |
needs: [ create-release, check-version ] | |
name: Build .exe | |
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 (onedir) | |
run: poetry run pyinstaller --hidden-import aiosqlite --onedir -n QCanvas --icon deploy/windows/qcanvas.ico qcanvas/run.py --windowed --noupx | |
- uses: vimtor/[email protected] | |
with: | |
files: dist/QCanvas | |
recursive: true | |
dest: QCanvas-onedir.zip | |
- name: Build pyinstaller (onefile) | |
run: poetry run pyinstaller --hidden-import aiosqlite --onefile -n QCanvas --icon deploy/windows/qcanvas.ico qcanvas/run.py --windowed --noupx | |
- name: Upload binaries | |
run: gh release upload ${{ needs.check-version.outputs.new-version }} dist/QCanvas.exe QCanvas-onedir.zip --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: | |
python_version: 3.11 | |
pypi_token: ${{ secrets.PYPI_TOKEN }} |