Skip to content

Build and publish

Build and publish #1

Workflow file for this run

name: Build and publish mkdocs-color-swatch-plugin
on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
variables:
name: Set environment variables
runs-on: ubuntu-latest
container:
image: ${{ vars.PYTHON_IMAGE }}
outputs:
version: ${{ env.VERSION }}
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install poetry
run: pip install poetry==${{ vars.POETRY_VERSION }}
- name: Save version to environment
run: echo "VERSION=$(poetry version -s)" >> "$GITHUB_ENV"
- name: Display version
run: echo "Version ${{ env.VERSION }}"
test:
uses: ./.github/workflows/test.yml
publish:
name: Publish package to PYPI
runs-on: ubuntu-latest
needs:
- test
- variables
container:
image: ${{ vars.PYTHON_IMAGE }}
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install poetry
run: pip install poetry==${{ vars.POETRY_VERSION }}
- name: Install project dependencies
run: poetry install
- name: Public package to PYPI via Poetry
run: poetry publish --build --no-interaction --username __token__ --password ${{ secrets.PYPI_TOKEN }}
create-release:
name: Create release
runs-on: ubuntu-latest
needs:
- variables
- publish
timeout-minutes: 5
steps:
- name: Release
uses: softprops/action-gh-release@v2
with:
name: Release v${{ needs.variables.outputs.version }}
tag_name: v${{ needs.variables.outputs.version }}
target_commitish: ${{ github.sha }}
generate_release_notes: true