-
Notifications
You must be signed in to change notification settings - Fork 1
92 lines (72 loc) · 2.35 KB
/
release.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Publishes a new release for the project
name: Release
on:
push:
branches: [ main ]
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
lint:
name: Lint
uses: ./.github/workflows/lint.yml
test:
name: Test
uses: ./.github/workflows/test.yml
release:
name: Prepare Release
runs-on: ubuntu-latest
needs: [ lint, test ]
steps:
- name: 🙌 Release Please
id: release-please
uses: google-github-actions/release-please-action@v4
with:
release-type: python
outputs:
releases_created: ${{ steps.release-please.outputs.releases_created }}
tag_name: ${{ steps.release-please.outputs.tag_name }}
major: ${{ steps.release-please.outputs.major }}
minor: ${{ steps.release-please.outputs.minor }}
patch: ${{ steps.release-please.outputs.patch }}
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [ release ]
if: ${{ needs.release.outputs.releases_created == 'true' }}
environment:
name: pypi
url: ${{ vars.PYPI_PROJECT_URL }}/${{ needs.release.outputs.major }}.${{ needs.release.outputs.minor }}.${{ needs.release.outputs.patch }}
steps:
- name: ✨ Checkout repository
uses: actions/checkout@v4
- name: 📖 Bootstrap Poetry
run: |
pipx install poetry
${{ vars.PYPI_REPO_URL && format('poetry config repositories.pypi {0}', vars.PYPI_REPO_URL) }}
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
- name: 🐍 Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: poetry
- name: ⬇️ Install dependencies
run: poetry install
- name: 🏗️ Build distribution/s
run: poetry build
- name: 🚀 Publish new release
run: poetry publish ${{ vars.PYPI_REPO_URL && '-r pypi' }}
- name: 📦 Upload artifact/s
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.release.outputs.tag_name }}
files: dist/*
docs:
name: Publish Docs
needs: [ release ]
if: ${{ needs.release.outputs.releases_created == 'true' }}
uses: ./.github/workflows/docs.yml
with:
version: ${{ needs.release.outputs.major }}.${{ needs.release.outputs.minor }}
aliases: latest