-
-
Notifications
You must be signed in to change notification settings - Fork 125
73 lines (63 loc) · 2.19 KB
/
python-build.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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Build
on:
release:
types: [published]
jobs:
deploy:
runs-on: ${{ matrix.cfg.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
cfg:
- {os: windows-latest, python-version: '3.9', architecture: x64}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.cfg.python-version }} ${{ matrix.cfg.architecture }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.cfg.python-version }}
architecture: ${{ matrix.cfg.architecture }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine pyinstaller~=5.6 build
- name: Setup
run: |
export BDISTWHEELFREEZELIBS=true
python -m build
python -m pip install dist/amulet_map_editor-*.whl --upgrade
- name: PyInstaller build
run: |
built_path=Amulet-v${{ github.event.release.tag_name }}-$RUNNER_OS-${{ matrix.cfg.architecture }}.zip
echo "BUILT_PATH=$built_path" >> $GITHUB_ENV
python -m PyInstaller -y Amulet.spec
cd dist
if [ "$RUNNER_OS" == "Windows" ]; then
7z a $built_path Amulet
elif [ "$RUNNER_OS" == "macOS" ]; then
zip -r $built_path Amulet
else
echo "$RUNNER_OS not supported"
exit 1
fi
cd ..
- name: Publish to PyPi
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.AMULET_MAP_EDITOR_PYPI_PASSWORD }}
run: |
twine upload dist/amulet[_-]map[_-]editor* --skip-existing
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./dist/${{ env.BUILT_PATH }}
asset_name: ${{ env.BUILT_PATH }}
asset_content_type: application/zip