-
Notifications
You must be signed in to change notification settings - Fork 45
76 lines (63 loc) · 2.01 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
name: Build and Publish release
on:
release:
types: [ created ]
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
actions: write
id-token: write
steps:
- name: Run Cimon
uses: cycodelabs/cimon-action@v0
with:
client-id: ${{ secrets.CIMON_CLIENT_ID }}
secret: ${{ secrets.CIMON_SECRET }}
prevent: true
allowed-hosts: >
files.pythonhosted.org
install.python-poetry.org
pypi.org
upload.pypi.org
*.sigstore.dev
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Load cached Poetry setup
id: cached-poetry
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-ubuntu-0 # increment to reset cache
- name: Setup Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
version: 1.8.3
- name: Add Poetry to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install Poetry Plugin
run: poetry self add "poetry-dynamic-versioning[plugin]"
- name: Check Pre-Release Version
id: check-version
run: |
echo "::debug::Package version: $(poetry version --short)"
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || echo prerelease=true >> $GITHUB_OUTPUT
- name: Exit if Pre-Release Version
if: steps.check-version.outputs.prerelease == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
- name: Build package
run: poetry build
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1