-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (68 loc) · 2.18 KB
/
deploy.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
# SPDX-FileCopyrightText: Copyright © 2024 Idiap Research Institute <[email protected]>
# SPDX-FileContributor: Yannick Dayer <[email protected]>
# SPDX-License-Identifier: BSD-3-Clause
name: deploy release
on:
release:
types: [published]
jobs:
release-packaging:
name: Package the project into a deploy-ready state
runs-on: ubuntu-22.04
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install build dependencies
run: |
pip install --upgrade pip
pip install build
- name: Package the project
run: python -m build
- name: Produce a GitHub actions artifact (the package)
uses: actions/upload-artifact@v4
with:
name: release-dist
path: dist/
if-no-files-found: error
pypi-publish:
name: Upload the release package to PyPI
needs:
- release-packaging
runs-on: ubuntu-22.04
environment:
name: pypi
url: https://pypi.org/p/clapper
permissions:
id-token: write # This permission is mandatory for trusted publishing
steps:
- name: Retrieve the package from GitHub actions artifacts
uses: actions/download-artifact@v4
with:
name: release-dist
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
github-publish:
name: Upload the release package to GitHub Release
needs:
- release-packaging
runs-on: ubuntu-22.04
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
steps:
- name: Retrieve the package from GitHub actions artifacts
uses: actions/download-artifact@v4
with:
name: release-dist
path: dist
- name: Upload the release package to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
run: gh release upload '${{ github.ref_name }}' dist/** --repo '${{ github.repository }}'