Skip to content

Commit 15980a1

Browse files
committed
ci: set up the package CD workflow
1 parent c760296 commit 15980a1

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/package-cd.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Package CD
2+
3+
on:
4+
push:
5+
tags:
6+
- "*.*.*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
package-version: ${{ steps.package-version.outputs.package-version }}
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-python@v5
16+
with:
17+
cache: pip
18+
- run: python -m pip install --upgrade pip
19+
- run: python -m pip install build
20+
- run: python -m build
21+
- uses: actions/upload-artifact@v4
22+
with:
23+
name: dist
24+
path: dist/*
25+
- run: python -m pip install .
26+
- id: package-version
27+
run: |
28+
echo "package-version=$(
29+
python -c 'import sys, management_commands; sys.stdout.write(management_commands.__version__)'
30+
)" >> $GITHUB_OUTPUT
31+
tag:
32+
needs:
33+
- build
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
- run: |
38+
if [ "${{ needs.build.outputs.package-version }}" != "${{ github.ref_name }}" ]; then
39+
exit 1
40+
fi
41+
pypi:
42+
needs:
43+
- tag
44+
runs-on: ubuntu-latest
45+
permissions:
46+
id-token: write
47+
environment:
48+
name: PyPI
49+
url: https://pypi.org/p/django-management-commands/
50+
steps:
51+
- uses: actions/download-artifact@v4
52+
with:
53+
name: dist
54+
path: dist/
55+
- uses: pypa/gh-action-pypi-publish@release/v1
56+
release:
57+
needs:
58+
- pypi
59+
runs-on: ubuntu-latest
60+
permissions:
61+
contents: write
62+
steps:
63+
- uses: actions/checkout@v4
64+
- uses: softprops/action-gh-release@v2
65+
with:
66+
generate_release_notes: true

0 commit comments

Comments
 (0)