-
Notifications
You must be signed in to change notification settings - Fork 17
74 lines (64 loc) · 2.44 KB
/
publish-wheels.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
name: Publish
on:
push:
branches: [ master ]
jobs:
pillow_heif_build:
if: "contains(github.event.head_commit.message, '[publish]')"
name: Pillow-Heif
uses: ./.github/workflows/wheels-pillow_heif.yml
pi_heif_build:
needs: [pillow_heif_build]
if: "contains(github.event.head_commit.message, '[publish]')"
name: Pi-Heif
uses: ./.github/workflows/wheels-pi_heif.yml
publish_pypi:
needs: [pi_heif_build]
if: "contains(github.event.head_commit.message, '[publish]')"
name: Upload to PyPi
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Get tag
run: |
RELEASE_VERSION=$(sed -n "s/^__version__.*\"\(.*\)\"$/\\1/p" ./pillow_heif/_version.py)
echo RELEASE_TAG="v$RELEASE_VERSION" >> $GITHUB_ENV
CHANGELOG=$(grep -oPz "(?s)##\s\[$RELEASE_VERSION.+?(?=##\s\[|$)" ./CHANGELOG.md | tr -d '\0' | sed /^$/d | sed '1d')
CHANGELOG=$(echo "$CHANGELOG" | sed '$!N;s/^###.*\n#/#/;P;D' | sed '$!N;s/^###.*\n#/#/;P;D' | sed '${/^###/d;}')
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Pillow-Heif sdist and wheels
uses: actions/download-artifact@v3
with:
name: wheels_pillow_heif
path: wheelhouse_pillow_heif
- name: Pi-Heif sdist and wheels
uses: actions/download-artifact@v3
with:
name: wheels_pi_heif
path: wheelhouse_pi_heif
- name: Publish Pillow-Heif
run: |
python3 -m pip install twine
python3 -m twine upload --skip-existing wheelhouse_pillow_heif/*.whl
python3 -m twine upload --skip-existing wheelhouse_pillow_heif/*tar.gz
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN_PILLOW_HEIF }}
- name: Publish Pi-Heif
run: |
python3 -m twine upload --skip-existing wheelhouse_pi_heif/*.whl
python3 -m twine upload --skip-existing wheelhouse_pi_heif/*tar.gz
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN_PI_HEIF }}
- name: Create release draft
uses: ncipollo/[email protected]
with:
name: ${{ env.RELEASE_TAG }}
tag: ${{ env.RELEASE_TAG }}
commit: ${{ github.ref }}
draft: false
body: ${{ env.CHANGELOG }}
token: ${{ secrets.PAT_PH }}