-
Notifications
You must be signed in to change notification settings - Fork 12
170 lines (143 loc) · 5.37 KB
/
build_app.yml
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: Build App & Release
on:
push:
tags:
- "v*.*.*"
branches:
- development
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
build:
runs-on: ${{ matrix.os-target.os }}
strategy:
matrix:
os-target:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Conda (windows)
if: matrix.os-target.os == 'windows-latest'
uses: s-weigand/setup-conda@v1
with:
activate-conda: false
- name: Install pdftotext dependencies (windows)
if: matrix.os-target.os == 'windows-latest'
run: |
conda install -c conda-forge poppler
- name: Install ocrmypdf dependencies (windows)
uses: MinoruSekine/[email protected]
if: matrix.os-target.os == 'windows-latest'
with:
apps: tesseract pdfquant ghostscript
- name: Setup brew (mac)
if: matrix.os-target.os == 'macos-latest'
uses: Homebrew/actions/setup-homebrew@master
- name: Install pdftotext dependencies (mac)
if: matrix.os-target.os == 'macos-latest'
run: brew install poppler ocrmypdf
- name: Install pdftotext dependencies (ubuntu)
if: matrix.os-target.os == 'ubuntu-latest'
uses: daaku/gh-action-apt-install@v4
with:
packages: build-essential libpoppler-cpp-dev pkg-config ocrmypdf
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ matrix.os-target.target }}
- name: Install Statement Sensei dependencies
uses: ./.github/actions/setup-python-poetry
with:
python-version: "3.11"
poetry-version: "1.8.3"
poetry-install-args: --with main --with build --without dev --extras ocrmypdf
# onedir mode doesn't work with ubuntu, build_appimage.sh fails
- name: Create executable for tauri (ubuntu)
if: matrix.os-target.os == 'ubuntu-latest'
run: |
poetry run pyinstaller entrypoint.onefile.spec
cp dist/entrypoint ./tauri/src-tauri/binaries/statementsensei-${{ matrix.os-target.target }}
- name: Create executable for tauri (windows)
if: matrix.os-target.os == 'windows-latest'
run: |
poetry run pyinstaller entrypoint.spec
cp dist/entrypoint/entrypoint ./tauri/src-tauri/binaries/statementsensei-${{ matrix.os-target.target }}
cp -r dist/entrypoint/_internal ./tauri/src-tauri/binaries/
# onedir mode doesn't work with macos due to missing Python framework
- name: Create executable for tauri (macos)
if: matrix.os-target.os == 'macos-latest'
run: |
poetry run pyinstaller entrypoint.onefile.spec
cp dist/entrypoint ./tauri/src-tauri/binaries/statementsensei-${{ matrix.os-target.target }}
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
workspaces: tauri/src-tauri
- name: Install tauri dependencies (ubuntu)
if: matrix.os-target.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y javascriptcoregtk-4.1 libsoup-3.0 webkit2gtk-4.1
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.0.6
run_install: false
- name: Install tauri
working-directory: tauri
run: pnpm install
- name: Build tauri app
working-directory: tauri/src-tauri/
run: pnpm tauri build -t ${{ matrix.os-target.target }}
- name: Upload tauri app
id: artifact_upload
uses: actions/upload-artifact@v4
with:
name: statementsensei-${{ matrix.os-target.target }}
path: |
tauri/src-tauri/target/${{ matrix.os-target.target }}/release/bundle/deb/
tauri/src-tauri/target/${{ matrix.os-target.target }}/release/bundle/nsis/
tauri/src-tauri/target/${{ matrix.os-target.target }}/release/bundle/dmg/
compression-level: 9
create_release:
if: github.ref != 'refs/heads/development'
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
merge-multiple: true
- name: Get Statement Sensei version
id: statement_sensei_version
run: echo "statement_sensei_version=$(grep "^version" pyproject.toml | cut -d'"' -f2)" >> $GITHUB_OUTPUT
- name: Create release changelog
run: |
pip install git-cliff==2.4.0
git fetch --tags
git cliff --latest > RELEASE_CHANGELOG.md
- name: Create a Github Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.statement_sensei_version.outputs.statement_sensei_version }}
target_commitish: main
body_path: RELEASE_CHANGELOG.md
files: ./artifacts/**/StatementSensei*