-
Notifications
You must be signed in to change notification settings - Fork 33
95 lines (83 loc) · 3.05 KB
/
release.yml
File metadata and controls
95 lines (83 loc) · 3.05 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---
name: Release new version on PyPI and DockerHub
on:
workflow_dispatch:
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@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- name: Extract version from prismacloud/cli/version.py
run: |
version=$(grep 'version = ' prismacloud/cli/version.py | sed -E "s/version = \"([^\"]+)\"/\1/")
echo "PRISMA_CLOUD_CLI_VERSION=$version" >> $GITHUB_ENV
- name: Create GitHub Release
run: |
gh release create ${{ env.PRISMA_CLOUD_CLI_VERSION }} --generate-notes --latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pypireleaser:
runs-on: ubuntu-latest
permissions: write-all
needs:
- create-github-release
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- name: Set up Python
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4
with:
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install pylint
pip install -r requirements.txt
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
- name: Install flake8
run: |
pip install flake8
- name: Analysing the code with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# execute overall flake8 scan
flake8 . --count --statistics
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
publish-dockerhub:
permissions: write-all
runs-on: ubuntu-latest
needs:
- pypireleaser
- create-github-release
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@219613003b08f4d049f34cb56c92e84345e1bb3f # v5
with:
name: simonpanw/prismacloud-cli
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
tags: "latest,${{ env.PRISMA_CLOUD_CLI_VERSION }}"
- name: Update Docker Hub README
uses: peter-evans/dockerhub-description@dc67fad7001ef9e8e3c124cb7a64e16d0a63d864 # v3.4.2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: simonpanw/prismacloud-cli
short-description: ${{ github.event.repository.description }}
readme-filepath: ./README.md