-
-
Notifications
You must be signed in to change notification settings - Fork 2
75 lines (61 loc) · 2.15 KB
/
ci-cd.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
name: ci-cd
on: [push, pull_request]
jobs:
release:
concurrency: release
permissions:
id-token: write
contents: write
# Only run this job if new work is pushed to "main"
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# Set up operating system
runs-on: ubuntu-latest
environment: release
# Define job steps
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Setup | Checkout Repository at workflow sha
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
ref: ${{ github.sha }}
- name: Setup | Force correct release branch on workflow sha
run: git checkout -B ${{ github.ref_name }} ${{ github.sha }}
- name: Action | Semantic Version Release
id: release
# Adjust tag with desired version if applicable.
uses: python-semantic-release/python-semantic-release@v9.9.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
git_committer_name: "github-actions"
git_committer_email: "actions@users.noreply.github.com"
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
- name: Test install from TestPyPI
if: steps.release.outputs.released == 'true'
run: |
pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
ithappens
- name: Publish to PyPI
if: steps.release.outputs.released == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
- name: Test install from PyPI
if: steps.release.outputs.released == 'true'
run: |
pip install ithappens --force-reinstall
- name: Publish | Upload to GitHub Release Assets
uses: python-semantic-release/publish-action@v9.9.0
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}