-
Notifications
You must be signed in to change notification settings - Fork 7
77 lines (67 loc) · 2 KB
/
deploy.yml
File metadata and controls
77 lines (67 loc) · 2 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: deploy
on:
workflow_run:
workflows:
- check
types:
- completed
branches:
- master
- develop
env:
PROJECT_NAME: psyke-python
WORKFLOW: depoly
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Deploy on PyPI and create release
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0 # all history
submodules: recursive
- name: Get All Tags
run: git fetch --tags -f
- name: Get Python Version
id: get-python-version
run: echo ::set-output name=version::$(cat .python-version)
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: ${{ steps.get-python-version.outputs.version }}
- name: Restore Python dependencies
run: |
pip install -r requirements.txt
- name: Change default logging level
run: sed -i -e 's/DEBUG/WARN/g' psyke/__init__.py
- name: Pack
run: python -m build
- name: Archive Dist Artifacts
if: failure() || success()
uses: actions/upload-artifact@v7
with:
name: dist
path: './dist'
- name: Upload
run: python -m twine upload dist/*
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERANAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
- name: Get Version
id: get-version
run: echo ::set-output name=version::$(python setup.py get_project_version | tail -n 1)
- name: Release Assets
id: upload-release-assets
run: |
set -x
ASSETS=()
for A in dist/*; do
ASSETS+=("-a" "$A")
echo "Releasing $A"
done
RELEASE_TAG='${{ steps.get-version.outputs.version }}'
gh release create "$RELEASE_TAG"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}