-
Notifications
You must be signed in to change notification settings - Fork 8
72 lines (69 loc) · 2.25 KB
/
publish.yaml
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
name: Publish package and docs
on:
release:
types:
- published
workflow_dispatch:
inputs:
reason:
description: Why did you trigger the pipeline?
required: False
default: Check if it runs again due to external changes
tag_name:
description: The name of the tag for which a package should be published
type: string
required: true
env:
GITHUB_BOT_USERNAME: github-actions[bot]
GITHUB_BOT_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
PY_COLORS: 1
jobs:
publish:
runs-on: ubuntu-latest
concurrency:
group: publish
steps:
- name: Checking out last commit in release
if: ${{ github.event_name != 'workflow_dispatch' }}
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: Checking out last commit for tag ${{ inputs.tag_name }}
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag_name }}
lfs: true
fetch-depth: 0
- name: Fail if running locally
if: ${{ env.ACT }} # skip during local actions testing
run: |
echo "Running action locally. Failing"
exit -1
- name: Setup Python 3.8
uses: ./.github/actions/python
with:
python_version: 3.8
- name: Get Current Version
run: |
export CURRENT_VERSION=$(python setup.py --version --quiet | awk -F. '{print $1"."$2"."$3}')
# Make the version available as env variable for next steps
echo CURRENT_VERSION=$CURRENT_VERSION >> $GITHUB_ENV
shell: bash
- name: Deploy Docs
uses: ./.github/actions/deploy-docs
with:
version: ${{ env.CURRENT_VERSION }}
alias: stable
title: ${{ env.CURRENT_VERSION }}
email: ${{ env.GITHUB_BOT_EMAIL }}
username: ${{ env.GITHUB_BOT_USERNAME }}
set-default: 'true'
- name: Build and publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload --verbose --non-interactive dist/*