-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (61 loc) · 2.08 KB
/
python-package.yml
File metadata and controls
73 lines (61 loc) · 2.08 KB
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
name: Python Build Release
on:
push:
branches: [ "main" ]
paths:
- 'src/version.py'
- 'requirements.txt'
- 'CHANGELOG.md'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10.x'
architecture: 'x64'
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Check version
id: version_check
run: |
version=$(python -c "from src.version import __version__; print(__version__)")
echo "Current version is $version"
echo "version=$version" >> $GITHUB_ENV
shell: bash
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pyinstaller
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Verify GitHub tag existence
id: tag_check
run: |
if git ls-remote --exit-code --tags origin "refs/tags/v${{ env.version }}" ; then
echo "Tag v${{ env.version }} already exists. Skipping release."
exit 1
else
echo "Tag v${{ env.version }} does not exist. Continuing."
fi
shell: bash
- name: Build with pyinstaller
run: |
pyinstaller --noconfirm --clean --paths=src src/main.py
- name: Package as ZIP
run: |
mkdir -p release
cp -r dist/main ./release
cd release
zip -r ../LR-JSONParser-v${{ env.version }}.zip ./*
- name: Create GitHub Release
if: ${{ github.ref == 'refs/heads/main' && steps.tag_check.outcome != 'failure' }}
uses: softprops/action-gh-release@v1
with:
tag_name: "v${{ env.version }}"
name: "Release v${{ env.version }}"
body: "New Release v${{ env.version }}"
files: "LR-JSONParser-v${{ env.version }}.zip"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}