Skip to content

Deploy

Deploy #199

Workflow file for this run

name: Deploy
on:
workflow_run:
types:
- completed
workflows:
- "Initialize"
- "Publish version"
- "Add document"
- "Publish draft"
concurrency:
group: deploy
cancel-in-progress: true
env:
DOCS_HOME: https://docs.crow.nl
jobs:
deploy-drafts:
name: Deploy working drafts
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Deploy live view 🚀
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs # The folder the action should deploy.
force: false
clean-exclude: |
v/**
commit-message: |
Deploying to docs.crow.nl from @ ${{ env.GITHUB_SHA }}
Reason: After push by ${{ github.actor }}
stale:
name: Redeploy docs.crow.nl
runs-on: ubuntu-latest
needs: [deploy-drafts]
permissions:
pages: write
steps:
- name: Trigger rebuild
run: |
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/pages/builds
- name: Enforce HTTPS for gh-pages
run: |
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/pages \
-d '{"https_enforced":true}'
notify-ci:
name: Inform docs.crow.nl
runs-on: ubuntu-latest
steps:
- name: Notify docs.crow.nl 🔔
run: |
set REPO_NAME=$(echo '${{ github.repository }}' | cut -d'/' -f2 )
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.NOTIFY_DOCS_CROW_NL }}" \
https://api.github.com/repos/stichting-crow/stichting-crow.github.io/dispatches \
-d '{"event_type":"respec-release","client_payload":{"repo":"$REPO_NAME"}}'
report-done:
name: Report
runs-on: ubuntu-latest
needs:
- notify-ci
- deploy-drafts
- stale
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Collect all files in gh-pages
run: |
REPO_NAME=$(echo '${{ github.repository }}' | cut -d'/' -f2 )
# go to branch gh-pages
git switch gh-pages
# find index.html files and get their html-title
find . -type f -name 'index.html' -exec sh -c "grep '<title>' {} | sed -e 's|</*title>||g' | xargs" \; > /tmp/index-titles.text
# find index.html files and construct (as we're on gh-pages) their
find . -type f -name 'index.html' \
| sed -r 's|/[^/]+$||' \
| sed -r "s|^.|$(echo $DOCS_HOME)/$(echo $REPO_NAME)|" > /tmp/index-filepaths.text
- name: Report as index.html
run: |
echo "## Now serving: 🍸" >> $GITHUB_STEP_SUMMARY
echo "| Title | URL |" >> $GITHUB_STEP_SUMMARY
echo "|-------|-----|" >> $GITHUB_STEP_SUMMARY
# merge with '|' (paste) the results of 1: index-titles.text, but with '|' replaced (sed); 2: the contents of index-filepaths.text
paste -d'|' <(sed -r 's/\|/-/' /tmp/index-titles.text) <(cat /tmp/index-filepaths.text) >> $GITHUB_STEP_SUMMARY