-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (97 loc) · 3.93 KB
/
python-package.yml
File metadata and controls
116 lines (97 loc) · 3.93 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
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python package
on:
push:
branches: [ "main" ]
paths-ignore:
- 'dist/**'
- 'images/**'
- '*.md'
- '*.png'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: ["3.10"]
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
if: matrix.os != 'windows-latest'
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
python -m pip install --upgrade pip
if (Test-Path requirements.txt) { pip install -r requirements.txt }
- name: Build executable
run: |
pyinstaller -y piperoni.spec
- name: Get piperoni verion (ubuntu and macos)
if: matrix.os != 'windows-latest'
run: |
export PIPERRONI_VERSION=$(python get_version.py)
echo "PIPERRONI_VERSION=$PIPERRONI_VERSION" >> $GITHUB_ENV
- name: Get piperoni verion (windows)
if: matrix.os == 'windows-latest'
run: |
echo "PIPERRONI_VERSION=$(python get_version.py)" >> $env:GITHUB_ENV
- name: Zip executable for windows
if: matrix.os == 'windows-latest'
run: |
Compress-Archive -Path dist/piperoni -DestinationPath piperoni-windows-${{ env.PIPERRONI_VERSION }}.zip
copy piperoni-windows-${{ env.PIPERRONI_VERSION }}.zip dist/
- name: Zip executable for ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
zip -j piperoni-ubuntu-${{ env.PIPERRONI_VERSION }}.zip /home/runner/work/Piperoni/Piperoni/dist/piperoni/*
cp piperoni-ubuntu-${{ env.PIPERRONI_VERSION }}.zip dist/
- name: Zip executable for macos
if: matrix.os == 'macos-latest'
run: |
zip -j piperoni-macos-${{ env.PIPERRONI_VERSION }}.zip /Users/runner/work/Piperoni/Piperoni/dist/piperoni/*
cp piperoni-macos-${{ env.PIPERRONI_VERSION }}.zip dist/
# - name: Publish executable
# uses: actions/upload-artifact@v2
# with:
# name: piperoni-${{ matrix.os }}-${{ matrix.python-version }}
# path: dist/piperoni-${{ matrix.os }}-${{ matrix.python-version }}.zip
- name: Configure git user
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Commit files to git (Windows)
if: matrix.os == 'windows-latest'
run: |
git pull origin main
git add dist/piperoni-windows-${{ env.PIPERRONI_VERSION }}.zip
git commit -a -m "Upload dist"
- name: Commit files to git (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
git pull origin main
git add dist/piperoni-ubuntu-${{ env.PIPERRONI_VERSION }}.zip
git commit -a -m "Upload dist"
- name: Commit files to git (macOS)
if: matrix.os == 'macos-latest'
run: |
git pull origin main
git add dist/piperoni-macos-${{ env.PIPERRONI_VERSION }}.zip
git commit -a -m "Upload dist"
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: ${{ github.head_ref }}
force_with_lease: true