Skip to content

Commit 6b68ba4

Browse files
authored
Build pyinstaller artifacts (#2)
* Build pyinstaller artifacts * add paths * update workflow * Only upload artifact on merge
1 parent 8def361 commit 6b68ba4

File tree

4 files changed

+69
-4
lines changed

4 files changed

+69
-4
lines changed

.github/workflows/build_and_publish.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
branches:
77
- main
88
pull_request:
9+
branches:
10+
- main
911
workflow_dispatch:
1012

1113
jobs:
@@ -53,3 +55,25 @@ jobs:
5355
user: __token__
5456
password: ${{ secrets.PYPI_CLOUD2SQL }}
5557
packages_dir: ./dist/
58+
59+
- name: Build binary
60+
id: pyinstaller
61+
run: |
62+
pip install pyinstaller
63+
pyinstaller --clean --noconfirm --log-level=WARN --distpath=dist --workpath=build cloud2sql.spec
64+
if [ "${{ github.ref_type }}" = tag ]; then
65+
echo "target=cloud2sql-${{ github.ref_name }}.linux-amd64" >> $GITHUB_OUTPUT
66+
else
67+
echo "target=cloud2sql-${GITHUB_SHA::7}.linux-amd64" >> $GITHUB_OUTPUT
68+
fi
69+
70+
- name: Move binary
71+
run: |
72+
mv dist/cloud2sql dist/${{ steps.pyinstaller.outputs.target }}
73+
74+
- name: Upload artifact
75+
if: github.event_name != 'pull_request' && github.event_name != 'workflow_dispatch'
76+
uses: actions/upload-artifact@v2
77+
with:
78+
name: ${{ steps.pyinstaller.outputs.target }}
79+
path: dist/${{ steps.pyinstaller.outputs.target }}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ MANIFEST
3636
# Usually these files are written by a python script from a template
3737
# before PyInstaller builds the exe, so as to inject date/other infos into it.
3838
*.manifest
39-
*.spec
4039

4140
# Installer logs
4241
pip-log.txt

cloud2sql.spec

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# -*- mode: python ; coding: utf-8 -*-
2+
3+
4+
block_cipher = None
5+
6+
7+
a = Analysis(
8+
['cloud2sql/__main__.py'],
9+
pathex=[],
10+
binaries=[],
11+
datas=[],
12+
hiddenimports=[],
13+
hookspath=[],
14+
hooksconfig={},
15+
runtime_hooks=[],
16+
excludes=[],
17+
win_no_prefer_redirects=False,
18+
win_private_assemblies=False,
19+
cipher=block_cipher,
20+
noarchive=False,
21+
)
22+
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
23+
24+
exe = EXE(
25+
pyz,
26+
a.scripts,
27+
a.binaries,
28+
a.zipfiles,
29+
a.datas,
30+
[],
31+
name='cloud2sql',
32+
debug=False,
33+
bootloader_ignore_signals=False,
34+
strip=False,
35+
upx=True,
36+
upx_exclude=[],
37+
runtime_tmpdir=None,
38+
console=True,
39+
disable_windowed_traceback=False,
40+
argv_emulation=False,
41+
target_arch=None,
42+
codesign_identity=None,
43+
entitlements_file=None,
44+
)

requirements.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
SQLAlchemy==2.0.0b3
55
PyYAML==6.0
66
rich==12.6.0
7+
resotolib==3.0.0rc3
78
resotoclient==1.2.1
89

910
# bundle popular db drivers
@@ -16,6 +17,3 @@ resoto-plugin-aws==3.0.0rc3
1617
resoto-plugin-digitalocean==3.0.0rc3
1718
resoto-plugin-gcp==3.0.0rc3
1819
resoto-plugin-k8s==3.0.0rc3
19-
resoto-plugin-slack==3.0.0rc3
20-
resoto-plugin-onelogin==3.0.0rc3
21-

0 commit comments

Comments
 (0)