-
Notifications
You must be signed in to change notification settings - Fork 3
56 lines (52 loc) · 1.72 KB
/
Copy pathpublish.yml
File metadata and controls
56 lines (52 loc) · 1.72 KB
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
name: Create release & publish to PyPI
# If ran manually, e.g. with ref set to "refs/tags/v1.2.3", set the run name to "Publish refs/tags/v1.2.3".
run-name: ${{ inputs.ref && format('Publish {0}', inputs.ref) || null }}
on:
push:
branches:
- main
# Run daily to keep the release PR date current
schedule:
- cron: '1 0 * * *'
workflow_dispatch:
inputs:
ref:
description: "The branch, tag or SHA to publish."
required: true
type: string
jobs:
release-please:
uses: City-of-Helsinki/.github/.github/workflows/release-please.yml@main
permissions:
contents: write
pull-requests: write
with:
include-component-in-tag: false
build:
needs:
- release-please
uses: City-of-Helsinki/.github/.github/workflows/build-python-dists.yml@main
with:
ref: ${{ inputs.ref }}
# Run build job if a release was created or a ref was specified (i.e. workflow was invoked manually)
if: ${{ needs.release-please.outputs.release_created || inputs.ref }}
publish-to-pypi:
name: Publish to PyPI
runs-on: ubuntu-latest
needs:
- build
# Run publish job if an artifact was uploaded
if: ${{ needs.build.outputs.artifact_name }}
environment:
name: pypi
url: https://pypi.org/p/django-ilmoitin
permissions:
id-token: write # mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ needs.build.outputs.artifact_name }}
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0