rendercv/.github/workflows/publish.yaml

94 lines
2.2 KiB
YAML

name: Publish to PyPI and update files
# GitHub events that triggers the workflow:
on:
release:
types: [released, edited]
jobs:
call_tests_workflow:
name: Test
uses: ./.github/workflows/test.yaml
publish:
name: Publish to PyPI
needs: [call_tests_workflow]
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install Hatch
uses: pypa/hatch@install
- name: Check if the release tag matches the version
uses: samuelcolvin/check-python-version@v4.1
with:
version_file_path: rendercv/__init__.py
- name: Build
run: |
hatch build
- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
update_files:
name: Update schema.json, examples, and entry figures
runs-on: ubuntu-latest
needs: [publish]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install Hatch
uses: pypa/hatch@install
- name: Set Git credentials
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Update schema.json
run: |
hatch run docs:update-schema
git add schema.json
git commit -m "docs: update schema.json"
- name: Update `examples` folder
run: |
hatch run docs:update-examples
git add examples/*
git commit -m "docs: update examples"
- name: Update entry figures
run: |
hatch run docs:update-entry-figures
git add docs/assets/**/*.png
git commit -m "docs: update entry figures"
- name: Push changes
run: |
git push