-
Notifications
You must be signed in to change notification settings - Fork 2
128 lines (120 loc) · 3.27 KB
/
ci.yaml
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
name: CI/CD
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
env:
PYTHON_VERSION: 3.x
jobs:
build-pkg:
name: Build Package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Poetry
run: pipx install poetry
- id: python
name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry
- name: Install Dependencies
run: poetry install
- name: Build Package
run: poetry build
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: package
path: dist/*
build-exe:
name: Build Executable
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install GNU Make
if: runner.os == 'macOS'
# https://formulae.brew.sh/formula/make
run: |-
brew install make
echo "$(brew --prefix)/opt/make/libexec/gnubin" >> ${GITHUB_PATH}
- name: Install Poetry
run: pipx install poetry
- id: python
name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry
- name: Install Dependencies
run: poetry install
- name: Build Executable
run: poetry run make dist
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-${{ runner.arch }}
path: dist/*
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
continue-on-error: true
release:
name: Create GitHub Release
runs-on: ubuntu-latest
outputs:
releases-created: ${{ steps.release.outputs.releases_created }}
tag-name: ${{ steps.release.outputs.tag_name }}
steps:
- id: release
name: Create GitHub Release
uses: google-github-actions/release-please-action@v3
with:
release-type: python
upload:
name: Upload Release Assets
needs:
- build-exe
- build-pkg
- release
if: needs.release.outputs.releases-created == 'true'
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Upload Release Assets
uses: softprops/action-gh-release@v0.1.15
with:
tag_name: ${{ needs.release.outputs.tag-name }}
files: artifacts/**/*
publish:
name: Publish to PyPI
needs:
- release
if: needs.release.outputs.releases-created == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Poetry
run: pipx install poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry
- name: Install Dependencies
run: poetry install
- name: Publish to PyPI
run: poetry publish --username="${{ secrets.PYPI_USERNAME }}" --password="${{ secrets.PYPI_PASSWORD }}" --build