Skip to content

Publish with dry-run on pull requests (#7) #17

Publish with dry-run on pull requests (#7)

Publish with dry-run on pull requests (#7) #17

Workflow file for this run

name: Publish
env:
# Enable colored output
# https://github.com/actions/runner/issues/241
PY_COLORS: 1
POETRY_VERSION: "1.6.1"
on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches:
- main
permissions:
contents: read
jobs:
publish-packages:
name: python-${{ matrix.python-version }}, ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- "3.12"
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
run: |
pip install poetry==${{ env.POETRY_VERSION }}
- name: Install zsh
run: |
sudo apt-get update
sudo apt-get install zsh
- name: Install packages
run: |
poetry install
- name: Collect scenarios
run: |
scenarios=(scenarios/**/*.json)
# Display for debug
for scenario in $scenarios
do
echo "$scenario"
done
echo "SCENARIOS=$scenarios" >> "$GITHUB_ENV"
# Assigning a glob to a variable in `bash` is such a pain I don't want to talk about it
# instead we just use zsh
shell: zsh {0}
- name: View scenarios
run: |
poetry run packse view $SCENARIOS
- name: Build scenarios
run: |
poetry run packse build $SCENARIOS
- name: Publish scenarios [dry-run]
if: github.ref != 'refs/heads/master'
run: |
poetry run packse publish --dry-run dist/*
- name: Publish scenarios
if: github.ref == 'refs/heads/master'
env:
TWINE_NON_INTERACTIVE: 1
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: |
poetry run packse publish --skip-existing dist/*