Debian Codegraph @

.github/workflows/deploy.yml

raw symbols SCIP
1 name: Release
2
3 on:
4 push:
5 branches:
6 - main
7 workflow_dispatch:
8 inputs:
9 release_force:
10 # see https://python-semantic-release.readthedocs.io/en/latest/github-action.html#command-line-options
11 description: |
12 Force release be one of: [major | minor | patch]
13 Leave empty for auto-detect based on commit messages.
14 type: choice
15 options:
16 - "" # auto - no force
17 - major # force major
18 - minor # force minor
19 - patch # force patch
20 default: ""
21 required: false
22 prerelease_token:
23 description: 'The "pre-release identifier" to use as a prefix for the "pre-release" part of a semver. Like the rc in `1.2.0-rc.8`.'
24 type: choice
25 options:
26 - rc
27 - beta
28 - alpha
29 default: rc
30 required: false
31 prerelease:
32 description: "Is a pre-release"
33 type: boolean
34 default: false
35 required: false
36
37 concurrency:
38 group: deploy
39 cancel-in-progress: false # prevent duplicates semantic-release
40
41 env:
42 PYTHON_VERSION_DEFAULT: "3.13"
43 POETRY_VERSION: "1.8.1"
44
45 permissions:
46 id-token: write
47 contents: write
48
49 jobs:
50 build-and-release:
51 # https://github.community/t/how-do-i-specify-job-dependency-running-in-another-workflow/16482
52 # limit this to being run on regular commits, not the commits that semantic-release will create
53 if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):')
54 runs-on: ubuntu-latest
55 concurrency: release
56 steps:
57 - name: Checkout code
58 uses: actions/checkout@v4
59 with:
60 fetch-depth: 0
61 - name: Setup Python Environment
62 # see https://github.com/actions/setup-python
63 uses: actions/setup-python@v5
64 with:
65 python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
66 architecture: 'x64'
67 - name: Install poetry
68 # see https://github.com/marketplace/actions/setup-poetry
69 uses: Gr1N/setup-poetry@v9
70 with:
71 poetry-version: ${{ env.POETRY_VERSION }}
72 - name: Install dependencies
73 run: poetry install --no-root
74
75 - name: Python Semantic Release
76 id: release
77 # see https://python-semantic-release.readthedocs.io/en/latest/automatic-releases/github-actions.html
78 # see https://github.com/python-semantic-release/python-semantic-release
79 uses: python-semantic-release/python-semantic-release@v10
80 with:
81 github_token: ${{ secrets.GITHUB_TOKEN }}
82 force: ${{ github.event.inputs.release_force }}
83 prerelease: ${{ github.event.inputs.prerelease }}
84 prerelease_token: ${{ github.event.inputs.prerelease_token }}
85
86 - name: Publish package distributions to PyPI
87 if: steps.release.outputs.released == 'true'
88 # see https://github.com/pypa/gh-action-pypi-publish
89 uses: pypa/gh-action-pypi-publish@release/v1
90
91 - name: Publish package distributions to GitHub Releases
92 if: steps.release.outputs.released == 'true'
93 # see https://github.com/python-semantic-release/upload-to-gh-release
94 uses: python-semantic-release/upload-to-gh-release@main
95 with:
96 github_token: ${{ secrets.GITHUB_TOKEN }}
97 tag: ${{ steps.release.outputs.tag }}