-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (131 loc) · 5.74 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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/*/* 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: 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
run: poetry run pyinstaller --hidden-import aiosqlite --onefile -n QCanvas --icon windows/qcanvas.ico qcanvas/run.py --windowed
- name: Upload binaries
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:
python_version: 3.11
pypi_token: ${{ secrets.PYPI_TOKEN }}
# update-metainfo:
# needs: check-version
# if: ${{ needs.check-version.outputs.needs-build == 'true' }}
# name: Update metainfo file
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: 3.12
# - run: python -m pip install xmltodict httpx
# - name: Update metainfo releases
# run: python flatpak/utils/metainfo-version-updater.py "${{ needs.check-version.outputs.new-version }}" "flatpak/io.github.qcanvas.QCanvasApp.metainfo.xml"
# - uses: EndBug/add-and-commit@v9
# with:
# add: "flatpak/io.github.qcanvas.QCanvasApp.metainfo.xml"
# default_author: github_actions
# message: Update metainfo file