-
Notifications
You must be signed in to change notification settings - Fork 21
58 lines (45 loc) · 1.62 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
name: aiodynamo release workflow
on:
release:
types: [released] # only triggered on release, not pre-release or draft release
permissions:
contents: read
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
PYTHON_VERSION: 3.11
TARGET_BRANCH: ${{ github.event.release.target_commitish }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
TAG_NAME: ${{ github.ref_name }}
jobs:
release:
name: Release to PyPI
runs-on: ubuntu-latest
steps:
- name: Check whether release target branch is default branch
if: env.TARGET_BRANCH != env.DEFAULT_BRANCH
uses: actions/github-script@v6
with:
script: |
core.setFailed('Target branch (${{ env.TARGET_BRANCH }}) is not default branch (${{ env.DEFAULT_BRANCH }}).')
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- run: curl -sSL https://install.python-poetry.org | python3 -
- run: echo "PKG_VER=$(poetry version --short)" >> $GITHUB_ENV
- name: Check whether current tag matches package version
if: env.TAG_NAME != env.PKG_VER
uses: actions/github-script@v6
with:
script: |
core.setFailed('Tag name (${{ env.TAG_NAME }}) does not match package version (${{ env.PKG_VER }}).')
- name: Build package
run: poetry build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1