-
Notifications
You must be signed in to change notification settings - Fork 3
54 lines (48 loc) · 1.58 KB
/
deploy-package-action.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
---
name: Deploy Salt Extension Python Package
on:
workflow_call:
inputs:
test:
type: boolean
required: false
default: true
version:
type: string
required: true
secrets:
PYPI_API_TOKEN:
required: false
TEST_PYPI_API_TOKEN:
required: false
jobs:
build:
name: Publish Python Package to ${{ fromJSON('["PyPI", "Test PyPI"]')[inputs.test] }}
runs-on: ubuntu-24.04
steps:
- name: Download Python Package Artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: salt-extension-${{ inputs.version }}-packages
path: dist
- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@1bb664cc2ddedbbfdde43d4ac135d5836b7bf40f # v1.11.0
if: ${{ inputs.test }}
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Create GitHub Release
if: ${{ !inputs.test }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ inputs.version }}" \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} ${{ inputs.version }}" \
--generate-notes \
dist/*
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@1bb664cc2ddedbbfdde43d4ac135d5836b7bf40f # v1.11.0
if: ${{ !inputs.test }}
with:
password: ${{ secrets.PYPI_API_TOKEN }}