Repository navigation
93 lines (80 loc) · 2.47 KB
/
Copy pathrelease.yml
File metadata and controls
93 lines (80 loc) · 2.47 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
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
84
85
86
87
88
89
90
91
92
93
name: Release
on:
push:
tags:
# Order matters, the last rule that applies to a tag is the one that
# takes effect. Dev tags are never published.
- '*'
- '!*.dev*'
env:
PYPI_URL: https://pypi.org/p/django-eav2
permissions: {}
jobs:
build:
name: Build distribution
# Prevent this workflow from running on forks
if: github.repository == 'django-commons/django-eav2'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
- name: Build package
run: |
uv build
uvx twine check dist/*
- name: Store the distribution packages
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
name: Publish distribution to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: ${{ env.PYPI_URL }}
permissions:
id-token: write # mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
github-release:
name: Upload distribution to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest
permissions:
contents: write # mandatory for making GitHub Releases
steps:
- name: Download all the dists
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: python-package-distributions
path: dist/
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
"${GITHUB_REF_NAME}"
--repo '${{ github.repository }}'
--draft
--generate-notes
- name: Upload artifact to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release upload
"${GITHUB_REF_NAME}" dist/**
--repo '${{ github.repository }}'