Commit from GitHub Actions (Update TagMark Data) #288
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: Update Tag Doc | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'docs/tag-doc.template' | |
- 'data/tagmarks.jsonl' | |
- 'data/tags.json' | |
workflow_dispatch: | |
env: | |
TAGMARK_UI_DIR: tagmark-ui | |
TAGMARK_PY_DIR: tagmark-py | |
TAGMARKS_JSON: ${{ github.workspace }}/data/tagmarks.jsonl | |
TAGS_JSON: ${{ github.workspace }}/data/tags.json | |
TAGS_DOC_TEMPLATE: ${{ github.workspace }}/docs/tag-doc.template | |
TAGS_DOC: ${{ github.workspace }}/docs/tag-doc.md | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
name: Update | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GH_PAT_TAGMARK }} | |
- name: Get and Merge tagmark-ui Code | |
uses: actions/checkout@v3 | |
with: | |
repository: pwnfan/tagmark-ui | |
path: ${{ env.TAGMARK_UI_DIR }} | |
ref: main | |
- name: Merge New tagmark-ui code | |
run: | | |
rm -rf \ | |
${{ env.TAGMARK_UI_DIR }}/.git* \ | |
${{ env.TAGMARK_UI_DIR }}/*.md \ | |
${{ env.TAGMARK_UI_DIR }}/LICENSE \ | |
${{ env.TAGMARK_UI_DIR }}/Makefile \ | |
${{ env.TAGMARK_UI_DIR }}/data/ \ | |
${{ env.TAGMARK_UI_DIR }}/docs/tag-doc.* | |
cp -rf ${{ env.TAGMARK_UI_DIR }}/* ./ | |
rm -rf ${{ env.TAGMARK_UI_DIR }} | |
- name: Checkout tagmark-py | |
uses: actions/checkout@v3 | |
with: | |
repository: pwnfan/tagmark-py | |
path: ${{ env.TAGMARK_PY_DIR }} | |
token: ${{ secrets.GH_PAT_TAGMARK }} | |
ref: main | |
- name: Setup Python | |
id: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Load Pip Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip | |
restore-keys: ${{ runner.os }}-pip | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Load Cached Venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Make TagMark Tag Doc | |
working-directory: ${{ env.TAGMARK_PY_DIR }} | |
run: | | |
poetry install --no-interaction | |
source .venv/bin/activate | |
poetry run tagmark_cli maketagdoc \ | |
-d ${{ env.TAGMARKS_JSON }} \ | |
-t ${{ env.TAGS_JSON }} \ | |
-u https://${{ github.actor }}.github.io/${GITHUB_REPOSITORY#*/} \ | |
-m ${{ env.TAGS_DOC_TEMPLATE }} \ | |
-o ${{ env.TAGS_DOC }} | |
- name: Commit and Push New Code | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: ${{ env.TAGS_DOC }} | |
default_author: github_actions | |
pull: '--autostash' |