workflows: update schema.json, examples folder, and entry figures with publish.yaml

This commit is contained in:
Sina Atalay 2024-06-20 15:36:12 +03:00
parent 4bacff4b79
commit f1b4cc972d
3 changed files with 54 additions and 59 deletions

View File

@ -10,6 +10,7 @@ permissions:
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -37,58 +38,4 @@ jobs:
- name: Deploy documentation
run: |
hatch run docs:deploy
- name: Update schema.json
run: |
hatch run docs:update-schema
- name: Update `examples` folder
run: |
hatch run docs:update-examples
- name: Update entry figures
run: |
hatch run docs:update-entry-figures
- name: Check if there are changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
schema:
- schema.json
examples:
- examples/*.yaml
entry-figures:
- docs/assets/**/*.png
- name: Update schema.json
if: steps.changes.outputs.schema == 'true'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add schema.json
git commit -m "docs: update schema.json"
- name: Update `examples` folder
if: steps.changes.outputs.examples == 'true'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add examples/*
git commit -m "docs: update examples"
- name: Update entry figures
if: steps.changes.outputs.entry-figures == 'true'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add docs/assets/**/*.png
git commit -m "docs: update entry figures"
- name: Push changes
if: steps.changes.outputs.schema == 'true' || steps.changes.outputs.examples == 'true' || steps.changes.outputs.entry-figures == 'true'
run: |
git push
hatch run docs:deploy

View File

@ -1,4 +1,4 @@
name: Publish to PyPI
name: Publish to PyPI and update files
# GitHub events that triggers the workflow:
on:
@ -43,3 +43,51 @@ jobs:
- 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

View File

@ -21,7 +21,7 @@ Run the following command to update the `examples` folder.
hatch run docs:update-examples
```
The [`deploy-docs`](https://github.com/sinaatalay/rendercv/blob/main/.github/workflows/deploy-docs.yaml) workflow also updates [`examples`](https://github.com/sinaatalay/rendercv/tree/main/examples) folder after each push to the `main` branch.
Once a new release is created on GitHub, the [`publish.yaml`](https://github.com/sinaatalay/rendercv/blob/main/.github/workflows/publish.yaml) workflow will be automatically triggered, and the `examples` folder will be updated to the most recent version.
## Updating figures of the entry types in the "[Structure of the YAML Input File](https://docs.rendercv.com/user_guide/structure_of_the_yaml_input_file/)"
@ -35,7 +35,7 @@ Run the following command to update the figures.
hatch run docs:update-entry-figures
```
The [`deploy-docs`](https://github.com/sinaatalay/rendercv/blob/main/.github/workflows/deploy-docs.yaml) workflow also updates the figures after each push to the `main` branch.
Once a new release is created on GitHub, the [`publish.yaml`](https://github.com/sinaatalay/rendercv/blob/main/.github/workflows/publish.yaml) workflow will be automatically triggered, and the figures will be updated to the most recent version.
## Updating the JSON Schema ([`schema.json`](https://github.com/sinaatalay/rendercv/blob/main/schema.json))
@ -49,4 +49,4 @@ Run the following command to update the JSON Schema.
hatch run docs:update-schema
```
The [`deploy-docs`](https://github.com/sinaatalay/rendercv/blob/main/.github/workflows/deploy-docs.yaml) workflow also updates [`schema.json`](https://github.com/sinaatalay/rendercv/blob/main/schema.json) after each push to the `main` branch.
Once a new release is created on GitHub, the [`publish.yaml`](https://github.com/sinaatalay/rendercv/blob/main/.github/workflows/publish.yaml) workflow will be automatically triggered, and `schema.json` will be updated to the most recent version.