-
Notifications
You must be signed in to change notification settings - Fork 7
83 lines (68 loc) · 2.41 KB
/
release.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
name: horde_sdk build and publish
on:
push:
branches:
- releases
jobs:
build-n-publish:
name: horde_sdk build and publish
runs-on: ubuntu-latest
environment: # see https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/
name: pypi
url: https://pypi.org/p/horde-sdk/
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write
pull-requests: read
steps:
- name: "📣 Release on push"
id: release
uses: rymndhng/release-on-push-action@v0.28.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
bump_version_scheme: patch
use_github_release_notes: true
- name: "✔️ Checkout"
uses: actions/checkout@v3
with:
fetch-depth: 0
# Pass the version number in an env var to the below steps
- name: Set build version env var
run: echo "SETUPTOOLS_SCM_PRETEND_VERSION=${{ steps.release.outputs.version }}" >> $GITHUB_ENV
# We need python...
- name: "🐍 Set up Python 3.10"
if: ${{ steps.release.outputs.version != '' }}
uses: actions/setup-python@v4
with:
python-version: "3.10"
# Install build deps
- name: "🛠 Install pypa/build"
if: ${{ steps.release.outputs.version != '' }}
run: |
python -m pip install --upgrade pip
python -m pip install build
# Build a pypi distribution using the env var version number
- name: "🔧 Build a binary wheel and a source tarball"
if: ${{ steps.release.outputs.version != '' }}
run: >-
python -m build --sdist --wheel --outdir dist/ .
# # Publish the package
- name: "📦 Publish distribution to PyPI"
if: ${{ steps.release.outputs.version != '' }}
uses: pypa/gh-action-pypi-publish@release/v1
# # Update the badges (maybe, if we're lucky)
# - name: "📦 Refresh pypi badge cache"
# run: >-
# curl -X PURGE
# url_here
# - name: "📦 Refresh downloads badge cache"
# run: >-
# curl -X PURGE
# url_here
# - name: "Inform with Discord Webhook"
# if: ${{ steps.release.outputs.version != '' }}
# uses: tsickert/discord-webhook@v5.3.0
# with:
# webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
# content: "New version of horde_sdk has been published to pypi: ${{ steps.release.outputs.version }}."