Add annotations from 2 sources #222
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: Build page from assets | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- assets | |
paths: | |
- 'annotations.json' | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: 'pages' | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{vars.MAIN_BRANCH}} | |
path: main | |
- name: Checkout assets branch | |
uses: actions/checkout@v3 | |
with: | |
ref: assets | |
path: assets | |
- name: Set env | |
run: | | |
echo "ASSETSDIR=$PWD/assets" >>$GITHUB_ENV | |
echo "MAINDIR=$PWD/main" >>$GITHUB_ENV | |
- name: Build _site files | |
run: > | |
${{env.MAINDIR}}/scripts/build.sh --all-data-tasks --all-file-tasks | |
--out ${{env.MAINDIR}}/docs | |
${{env.ASSETSDIR}}/annotations.json | |
- name: Build bookcovers | |
run: > | |
${{env.MAINDIR}}/scripts/build.sh --book-covers | |
--out ${{env.ASSETSDIR}} | |
${{env.ASSETSDIR}}/annotations.json | |
- name: Create store.json | |
run: | | |
jq -s '.' ${{env.ASSETSDIR}}/store/*.json > ${{env.MAINDIR}}/docs/_data/store.json | |
- name: Commit and push | |
working-directory: assets | |
run: | | |
if [[ -n $(git ls-files -om store covers) ]]; then | |
git config user.name "github-actions" | |
git config user.email "actions@users.noreply.github.com" | |
git config push.default current | |
git pull | |
git add . | |
git commit -m "Update" | |
git push | |
fi | |
- name: Build with Jekyll | |
uses: actions/jekyll-build-pages@v1 | |
with: | |
source: ./main/docs | |
destination: ./main/docs/_site | |
verbose: false | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
name: github-pages | |
path: ./main/docs/_site/ | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |