-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (56 loc) · 1.84 KB
/
Copy pathrelease.yml
File metadata and controls
59 lines (56 loc) · 1.84 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
name: Publish and release CumulusCI_AzureDevOps
on:
workflow_dispatch:
push:
branches:
- main
paths:
- cumulusci/__about__.py
concurrency: publishing
jobs:
publish-to-pypi:
name: Publish new release to PyPI
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12
cache: pip
- name: Install build tools
run: python -m pip install hatch tomli tomli-w
- name: Check version type
id: version_check
run: |
VERSION=$(hatch version)
echo "Current version: $VERSION"
IS_PUBLISHABLE="false"
# Publish only stable and preview releases, which do not contain letters like a,b,d or "rc".
if ! [[ "$VERSION" =~ [abd] ]] && ! [[ "$VERSION" =~ "rc" ]]; then
IS_PUBLISHABLE="true"
fi
echo "publishable=${IS_PUBLISHABLE}" >> $GITHUB_OUTPUT
- name: Build source tarball and binary wheel
if: steps.version_check.outputs.publishable == 'true'
run: hatch build -c
- name: Upload to PyPI
if: steps.version_check.outputs.publishable == 'true'
run: hatch publish
env:
HATCH_INDEX_USER: "__token__"
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}
- name: Create release
if: steps.version_check.outputs.publishable == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="$(hatch version)"
awk '/<!-- latest-start -->/,/<!-- latest-stop -->/' docs/history.md > changelog.md
gh release create "v$VERSION" \
dist/*.whl \
dist/*.tar.gz \
--notes-file changelog.md \
--title $VERSION