-
Notifications
You must be signed in to change notification settings - Fork 2
165 lines (137 loc) · 4.38 KB
/
main.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
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Main
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [created]
permissions:
contents: read
jobs:
lint:
name: Lint code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
cache: poetry
- name: Install deps
run: poetry install
- name: Lint code
run: poetry run poe lint
tests:
name: Tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install deps
run: poetry install
- name: Run tests
run: poetry run poe test
env:
UPLOADCARE_KEY: ${{ secrets.UPLOADCARE_KEY }}
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6
publish-pypi:
name: Release to PyPI
if: github.event_name == 'release' && github.event.action == 'created'
needs: [lint, tests]
permissions:
id-token: write
environment: pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: |
pipx install poetry
pipx inject poetry poetry-dynamic-versioning[plugin]
- uses: actions/setup-python@v5
- name: Build package
run: poetry build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf # v1.8.11
publish-aur:
name: Release to AUR
if: github.event.release.prerelease != true
needs: [publish-pypi]
environment: aur
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update version
run: |
VERSION="${GITHUB_REF#refs/tags/v}"
sed -i "s|\(^pkgver=\).*$|\1\"${VERSION}\"|" ./PKGBUILD
- name: Deploy PKGBUILD to the Arch User Repository
uses: KSXGitHub/github-actions-deploy-aur@063daf78a56662642bb00049ce78425ff6d0fad7 # v2.7.0
with:
pkgname: python-images-upload-cli
pkgbuild: ./PKGBUILD
commit_username: DeadNews
commit_email: aurczpbgr@mozmail.com
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: Upstream release ${{ github.ref }}
updpkgsums: true
build:
name: Build
if: github.event_name == 'release' && github.event.action == 'created'
needs: [lint, tests]
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
python-version: "3.11"
artifact_name: images-upload-cli.exe
archive_type: zip
asset_name: images-upload-cli_${{ github.ref_name }}_windows_amd64.zip
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install deps
run: poetry install
- name: Build binaries
uses: nuitka/nuitka-action@12e193a947ea7cb9c807a4e4161092f2c16ac501 # v1.1
with:
nuitka-version: main
script-name: src/images_upload_cli/__main__.py
onefile: true
output-file: ${{ matrix.artifact_name }}
- name: Archive binaries
uses: thedoctor0/zip-release@b57d897cb5d60cb78b51a507f63fa184cfe35554 # 0.7.6
with:
type: ${{ matrix.archive_type }}
directory: build
path: ${{ matrix.artifact_name }}
filename: ${{ matrix.asset_name }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@1beeb572c19a9242f4361f4cee78f8e0d9aec5df # v2.7.0
with:
file: build/${{ matrix.asset_name }}
asset_name: ${{ matrix.asset_name }}
make_latest: false