Use reclass-rs
in Commodore Docker image
#2048
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PyPI release | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build-and-publish: | |
# Skip job on forks | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false | |
name: Build and publish to PyPI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- uses: Gr1N/setup-poetry@v8 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: ${{ runner.os }}-publish-pypi-${{ hashFiles('poetry.lock') }} | |
- name: Setup poetry environment | |
run: | | |
poetry install | |
- name: Inject package versions to action env | |
run: make inject-version | |
- name: Set Python package version for release | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: poetry version "${PYVERSION}" | |
- name: Set Python package version | |
if: "!startsWith(github.ref, 'refs/tags/v')" | |
run: | | |
poetry version "${PYVERSION}.dev${GITHUB_RUN_NUMBER}" | |
- name: Build Python package | |
run: poetry build | |
- name: Publish to PyPI | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }} | |
- name: Publish to TestPyPI | |
if: "!startsWith(github.ref, 'refs/tags/v')" | |
run: | | |
poetry config repositories.test-pypi https://test.pypi.org/legacy/ | |
poetry publish -r test-pypi -u __token__ -p ${{ secrets.TEST_PYPI_TOKEN }} |