-
Notifications
You must be signed in to change notification settings - Fork 28
69 lines (57 loc) · 1.8 KB
/
publish.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
name: publish
on:
release:
types: [created]
jobs:
fix_release_deps:
permissions: write-all
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip pip-tools setuptools
- name: Set configuration
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
- name: Create requirements files
run: |
python tools/generate_requirements_txt.py
git add requirements.txt
git commit -m "Updated requirements.txt files" || true
- name: Bump version to new tag
run: |
python -m pip install bump-my-version
bump-my-version bump --new-version $GITHUB_REF_NAME patch
git commit -am "Bump version to: $GITHUB_REF_NAME"
- name: Push back changes to main and tag
run: |
git tag --force $GITHUB_REF_NAME HEAD
git push --force --tags
git switch -C main
git push --set-upstream -f origin main
deploy:
needs: fix_release_deps
runs-on: ubuntu-latest
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build setuptools>=61.2 wheel
python -m build --no-isolation
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1