Skip to content

Update files

Update files #39

Workflow file for this run

# This action will regenerate generated files on a weekly schedule.
#
# For documentation on the github environment, see
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
#
# For documentation on the syntax of this file, see
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: Update
on:
# Allow this workflow to be manually triggered.
workflow_dispatch:
# Run this once a week on saturday at 9pm UTC.
schedule:
- cron: '0 21 * * 6'
permissions:
contents: read
jobs:
generate-files:
permissions:
contents: write # for Git to git push
pull-requests: write # for Git to create a pull request
runs-on: ubuntu-latest
env:
SPECDIR: ../specification/
EXTDIR: ../extracted-files/
strategy:
matrix:
include:
- BRANCH: 'main'
GEDCOM_BRANCH: 'release'
- BRANCH: 'next-minor'
GEDCOM_BRANCH: 'v7.1'
- BRANCH: 'next-patch'
GEDCOM_BRANCH: 'main'
steps:
- name: Checkout GEDCOM.io
uses: actions/checkout@v4
with:
path: GEDCOM.io
ref: ${{matrix.BRANCH}}
- name: Checkout GEDCOM
if: matrix.GEDCOM_BRANCH != 'release'
uses: actions/checkout@v4
with:
repository: FamilySearch/GEDCOM
path: GEDCOM
ref: ${{matrix.GEDCOM_BRANCH}}
- name: Get latest release tag
if: matrix.GEDCOM_BRANCH == 'release'
id: latesttag
run: |
LATEST_TAG=$(curl --silent "https://api.github.com/repos/FamilySearch/GEDCOM/releases/latest" | jq -r .tag_name)
echo "::set-output name=tag::${LATEST_TAG}"
- name: Checkout latest GEDCOM release
if: matrix.GEDCOM_BRANCH == 'release'
uses: actions/checkout@v4
with:
repository: FamilySearch/GEDCOM
path: GEDCOM
ref: ${{steps.latesttag.outputs.tag}}
- name: Generate GEDCOM-tmp.md
working-directory: ${{github.workspace}}/GEDCOM/build
shell: sh
run: |
export MD_FILES=$(ls ${{ env.SPECDIR }}gedcom*.md | sort)
python3 hyperlink.py ${MD_FILES} GEDCOM-tmp.md
ls -l GEDCOM-tmp.md
- name: Generate GEDCOM-tmp.html
working-directory: ${{github.workspace}}/GEDCOM/build
shell: sh
run: |
export MODTIME=$(git log -1 --date="format:%_d %B %Y" --format="%ad" -- ${SPECDIR})
export PDARGS="--syntax-definition=gedcom.xml --syntax-definition=gedstruct.xml --syntax-definition=abnf.xml --from=markdown+smart --standalone --css=pandoc.css --template=template.html --toc --number-sections --self-contained --highlight-style=kate --wrap=none"
docker run --rm --volume "`pwd`:/data" pandoc/latex:2.9 GEDCOM-tmp.md -o GEDCOM-tmp.html ${PDARGS} --metadata=date:"${MODTIME}"
ls -l GEDCOM-tmp.html
- name: Generate gedcom.html
working-directory: ${{github.workspace}}/GEDCOM/build
run: |
python3 hyperlink-code.py GEDCOM-tmp.html ../specification/gedcom.html
ls -l ../specification/gedcom.html
- name: Install weasyprint
run: |
python3 -mpip install --user weasyprint==52.5
- name: Generate gedcom.pdf
working-directory: ${{github.workspace}}/GEDCOM/build
run: |
python3 -mweasyprint ../specification/gedcom.html ../specification/gedcom.pdf
ls -l ../specification/gedcom.pdf
- name: Prep GEDCOM.io
if: matrix.GEDCOM_BRANCH == 'release'
working-directory: ${{github.workspace}}/GEDCOM/build
run: |
ls ../../GEDCOM.io
python3 push_to_gedcomio.py ../../GEDCOM.io
- name: Set git config
env:
GH_TOKEN: ${{ github.token }}
run: |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "$(gh api /users/${GITHUB_ACTOR} | jq .name -r)"
git config -l
- name: Check for diffs
id: diff
working-directory: ${{github.workspace}}/GEDCOM.io
run: |
git diff --quiet origin/${{matrix.BRANCH}} . || echo "::set-output name=status::changes"
shell: bash
- name: Create Pull Request
if: steps.diff.outputs.status == 'changes'
working-directory: ${{github.workspace}}/GEDCOM.io
run: |
git checkout -b generate-${{matrix.BRANCH}}-files
git add .
git commit -m "Update generated files"
git push -f origin generate-${{matrix.BRANCH}}-files
if ! gh pr list | grep -q "generate-${{matrix.BRANCH}}-files"; then
gh pr create -B ${{matrix.BRANCH}} -H generate-${{matrix.BRANCH}}-files --title 'Update generated files' --body $'Update generated files\nThis PR is auto-generated by [gh pr create].' --label 'automated pr'
fi
env:
GH_TOKEN: ${{ github.token }}