Skip to content

Commit

Permalink
Pass tag to workflow call (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiran authored Aug 8, 2022
1 parent e0c7fd6 commit 10a10e7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ on:
pull_request:
branches: [ "main", "v*" ]
workflow_dispatch:
inputs:
tag:
description: tag to build
required: false
type: string
workflow_call:
inputs:
tag:
description: tag to build
required: true
type: string

permissions:
contents: read
Expand Down Expand Up @@ -35,6 +45,8 @@ jobs:
- "pypy-3.9"
steps:
- uses: "actions/checkout@v3"
with:
ref: ${{ inputs.tag || github.ref }}
- uses: "actions/setup-python@v4"
with:
python-version: "${{ matrix.python-version }}"
Expand All @@ -52,6 +64,8 @@ jobs:
needs: tests
steps:
- uses: "actions/checkout@v3"
with:
ref: ${{ inputs.tag || github.ref }}
- uses: "actions/setup-python@v4"
with:
python-version: "3.10"
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ on:
jobs:
tests:
uses: ./.github/workflows/main.yml
with:
tag: ${{ inputs.tag }}
pypi:
name: Build and upload to PyPI
runs-on: ubuntu-latest
Expand All @@ -31,7 +33,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.tag || github.ref }}
ref: ${{ inputs.tag }}
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
Expand All @@ -45,13 +47,13 @@ jobs:
- name: "Run twine check"
run: "python -m twine check dist/*"
- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
if: inputs.testpypi || false
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
if: inputs.pypi || false

0 comments on commit 10a10e7

Please sign in to comment.