-
Notifications
You must be signed in to change notification settings - Fork 3
54 lines (49 loc) · 1.5 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:
if: github.repository_owner == 'salt-extensions'
name: Publish Python Package to ${{ fromJSON('["PyPI", "Test PyPI"]')[inputs.test] }}
runs-on: ubuntu-latest
steps:
- name: Download Python Package Artifacts
uses: actions/download-artifact@v4
with:
name: salt-extension-${{ inputs.version }}-packages
path: dist
- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
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 "$GITHUB_REF_NAME" \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} ${{ inputs.version }}" \
--generate-notes \
dist/*
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ !inputs.test }}
with:
password: ${{ secrets.PYPI_API_TOKEN }}