| 1 |
name: Publish Release |
| 2 |
|
| 3 |
on: |
| 4 |
workflow_dispatch: |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
permissions: |
| 10 |
contents: write |
| 11 |
id-token: write |
| 12 |
|
| 13 |
jobs: |
| 14 |
rl-scanner: |
| 15 |
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/')) |
| 16 |
runs-on: ubuntu-latest |
| 17 |
steps: |
| 18 |
- uses: actions/checkout@v5 |
| 19 |
with: |
| 20 |
fetch-depth: 0 |
| 21 |
fetch-tags: true |
| 22 |
|
| 23 |
- name: Configure Python |
| 24 |
uses: actions/setup-python@v6 |
| 25 |
with: |
| 26 |
python-version: "3.12" |
| 27 |
|
| 28 |
- name: Build artifact |
| 29 |
run: | |
| 30 |
pip install --user --upgrade pip |
| 31 |
pip install --user pipx |
| 32 |
pipx ensurepath |
| 33 |
pipx install poetry |
| 34 |
poetry config virtualenvs.in-project true |
| 35 |
poetry install --with dev |
| 36 |
poetry build |
| 37 |
tar -czvf auth0-python.tgz * |
| 38 |
|
| 39 |
- name: Get version |
| 40 |
id: get_version |
| 41 |
uses: ./.github/actions/get-version |
| 42 |
|
| 43 |
- name: Run RL Scanner |
| 44 |
uses: auth0/devsecops-tooling/.github/actions/rl-scan@main |
| 45 |
with: |
| 46 |
artifact-name: "auth0-python" |
| 47 |
artifact-path: "${{ github.workspace }}/auth0-python.tgz" |
| 48 |
version: ${{ steps.get_version.outputs.version }} |
| 49 |
RLSECURE_LICENSE: ${{ secrets.RLSECURE_LICENSE }} |
| 50 |
RLSECURE_SITE_KEY: ${{ secrets.RLSECURE_SITE_KEY }} |
| 51 |
SIGNAL_HANDLER_TOKEN: ${{ secrets.SIGNAL_HANDLER_TOKEN }} |
| 52 |
SIGNAL_HANDLER_DOMAIN: ${{ secrets.SIGNAL_HANDLER_DOMAIN }} |
| 53 |
PRODSEC_TOOLS_ARN: ${{ secrets.PRODSEC_TOOLS_ARN }} |
| 54 |
PRODSEC_TOOLS_USER: ${{ secrets.PRODSEC_TOOLS_USER }} |
| 55 |
PRODSEC_TOOLS_TOKEN: ${{ secrets.PRODSEC_TOOLS_TOKEN }} |
| 56 |
PRODSEC_PYTHON_TOOLS_REPO: ${{ secrets.PRODSEC_PYTHON_TOOLS_REPO }} |
| 57 |
|
| 58 |
publish-pypi: |
| 59 |
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/')) |
| 60 |
name: "PyPI" |
| 61 |
runs-on: ubuntu-latest |
| 62 |
needs: rl-scanner |
| 63 |
environment: release |
| 64 |
|
| 65 |
steps: |
| 66 |
- name: Checkout code |
| 67 |
uses: actions/checkout@v5 |
| 68 |
with: |
| 69 |
fetch-depth: 0 |
| 70 |
fetch-tags: true |
| 71 |
|
| 72 |
|
| 73 |
- id: get_version |
| 74 |
uses: ./.github/actions/get-version |
| 75 |
|
| 76 |
|
| 77 |
- id: get_prerelease |
| 78 |
uses: ./.github/actions/get-prerelease |
| 79 |
with: |
| 80 |
version: ${{ steps.get_version.outputs.version }} |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
- id: get_release_notes |
| 85 |
uses: ./.github/actions/get-release-notes |
| 86 |
with: |
| 87 |
token: ${{ secrets.GITHUB_TOKEN }} |
| 88 |
version: ${{ steps.get_version.outputs.version }} |
| 89 |
repo_owner: ${{ github.repository_owner }} |
| 90 |
repo_name: ${{ github.event.repository.name }} |
| 91 |
|
| 92 |
|
| 93 |
- uses: ./.github/actions/release-create |
| 94 |
with: |
| 95 |
token: ${{ secrets.GITHUB_TOKEN }} |
| 96 |
name: ${{ steps.get_version.outputs.version }} |
| 97 |
body: ${{ steps.get_release_notes.outputs.release-notes }} |
| 98 |
tag: ${{ steps.get_version.outputs.version }} |
| 99 |
commit: ${{ github.sha }} |
| 100 |
prerelease: ${{ steps.get_prerelease.outputs.prerelease }} |
| 101 |
|
| 102 |
- name: Configure Python |
| 103 |
uses: actions/setup-python@v6 |
| 104 |
with: |
| 105 |
python-version: "3.10" |
| 106 |
|
| 107 |
- name: Configure dependencies |
| 108 |
run: | |
| 109 |
pip install --user --upgrade pip |
| 110 |
pip install --user pipx |
| 111 |
pipx ensurepath |
| 112 |
pipx install poetry |
| 113 |
poetry config virtualenvs.in-project true |
| 114 |
poetry install --with dev |
| 115 |
poetry self add "poetry-dynamic-versioning[plugin]" |
| 116 |
|
| 117 |
- name: Build release |
| 118 |
run: | |
| 119 |
poetry build |
| 120 |
|
| 121 |
- name: Publish release |
| 122 |
uses: pypa/gh-action-pypi-publish@release/v1 |