release: 1.0.2 #40
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: Run Project | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
workflow_dispatch: | |
inputs: | |
script_name: | |
description: 'poetry script name' | |
required: true | |
default: '' | |
env: | |
POETRY_SCRIPT_NAME_LIST: 'example' | |
jobs: | |
run-project: | |
name: Run project on ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
if: github.event_name == 'push' || github.event.inputs.script_name != '' | |
strategy: | |
matrix: | |
python-version: ['3.7', '3.8', '3.9', '3.10'] | |
poetry-version: ['1.3.1'] | |
os: [ubuntu-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: ${{ matrix.poetry-version }} | |
- name: Install dependencies | |
run: | | |
poetry install --sync --all-extras | |
- name: Run poetry script | |
run: | | |
if [ -z "${{ github.event.inputs.script_name }}" ]; then | |
echo "No script name provided, running all scripts" | |
for script_name in $(echo "${{ env.POETRY_SCRIPT_NAME_LIST }}" | tr "," " ") | |
do | |
echo "Running poetry script $script_name" | |
poetry run $script_name | |
done | |
else | |
echo "Running poetry script ${{ github.event.inputs.script_name }}" | |
poetry run ${{ github.event.inputs.script_name }} | |
fi |