Skip to content

Commit d1feb4f

Browse files
committed
ci: switch release.yml to more common publish.yml
Contains the release and pypi publish and uses the coh common workflow. Refs: RATYK-200
1 parent 35fcf86 commit d1feb4f

2 files changed

Lines changed: 56 additions & 27 deletions

File tree

.github/workflows/publish.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Create release & publish to PyPI
2+
# 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".
3+
run-name: ${{ inputs.ref && format('Publish {0}', inputs.ref) || null }}
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
# Run daily to keep the release PR date current
10+
schedule:
11+
- cron: '1 0 * * *'
12+
workflow_dispatch:
13+
inputs:
14+
ref:
15+
description: "The branch, tag or SHA to publish."
16+
required: true
17+
type: string
18+
19+
jobs:
20+
release-please:
21+
uses: City-of-Helsinki/.github/.github/workflows/release-please.yml@main
22+
permissions:
23+
contents: write
24+
pull-requests: write
25+
with:
26+
include-component-in-tag: false
27+
28+
build:
29+
needs:
30+
- release-please
31+
uses: City-of-Helsinki/.github/.github/workflows/build-python-dists.yml@main
32+
with:
33+
ref: ${{ inputs.ref }}
34+
# Run build job if a release was created or a ref was specified (i.e. workflow was invoked manually)
35+
if: ${{ needs.release-please.outputs.release_created || inputs.ref }}
36+
37+
publish-to-pypi:
38+
name: Publish to PyPI
39+
runs-on: ubuntu-latest
40+
needs:
41+
- build
42+
# Run publish job if an artifact was uploaded
43+
if: ${{ needs.build.outputs.artifact_name }}
44+
environment:
45+
name: pypi
46+
url: https://pypi.org/p/django-ilmoitin
47+
permissions:
48+
id-token: write # mandatory for trusted publishing
49+
steps:
50+
- name: Download all the dists
51+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
52+
with:
53+
name: ${{ needs.build.outputs.artifact_name }}
54+
path: dist/
55+
- name: Publish distribution to PyPI
56+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0

.github/workflows/release.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)