-
Notifications
You must be signed in to change notification settings - Fork 55
59 lines (52 loc) · 1.6 KB
/
pypi.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
# https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Upload Python Package
on:
release:
types: [published]
pull_request:
types:
- closed
jobs:
create-github-release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Extract version from prismacloud/cli/version.py
run: |
version=$(grep 'version = ' prismacloud/api/version.py | sed -E "s/version = \"([^\"]+)\"/\1/")
echo "PRISMA_CLOUD_API_VERSION=$version" >> $GITHUB_ENV
- name: Create GitHub Release
run: |
gh release create ${{ env.PRISMA_CLOUD_API_VERSION }} --generate-notes --latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy:
runs-on: ubuntu-latest
needs:
- create-github-release
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install pylint
pip install -r requirements.txt
- name: Test API
run: |
pylint prismacloud/api
- name: Build
run: |
python -m build
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}