Process and Publish Contribution #20
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: Contribution Processor | |
run-name: Process and Publish Contribution | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'public/features/**/hub.md' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'public/features/**/hub.md' | |
jobs: | |
process_hub_file: | |
runs-on: ubuntu-latest | |
name: Process Hub and Update Search | |
steps: | |
- run: echo "${{ github.event_name }} event detected." | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '2' | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
- name: Install | |
run: npm ci | |
- id: file_chnages | |
uses: trilom/[email protected] | |
with: | |
output: 'json' | |
fileOutput: 'json' | |
- name: Show files changed | |
run: cat $HOME/files.json | |
- name: "Absolutify Links" | |
id: linking | |
run: | | |
node ./scripts/pipeline.js \ | |
--phase link | |
- name: "Create tracking file" | |
id: tracking | |
run: echo "[]" > $HOME/tracker.json | |
- name: "Transform files" | |
id: html-transform | |
run: | | |
node ./scripts/pipeline.js \ | |
--phase transform | |
- name: "Show tracked entries" | |
run: cat $HOME/tracker.json | |
- name: Update search tools collection | |
id: search | |
run: | | |
node ./scripts/pipeline.js \ | |
--phase searchupdate \ | |
--searchFile $(pwd)/public/data/pages/searchToolsCollection.json | |
- name: "Show all" | |
run: "ls -R public/features/" | |
- name: "Commit changes" | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git add public/features/ public/data/pages/searchToolsCollection.json | |
git commit -m "Convert hub.md and update search" | |
git push | |
publish: | |
runs-on: ubuntu-latest | |
name: Deploy to GitHub Pages | |
needs: process_hub_file | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Merge main into gh-pages | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git fetch origin | |
git checkout gh-pages | |
git merge main --no-edit --allow-unrelated-histories | |
git push origin gh-pages | |
- name: Install Dependencies | |
run: npm ci | |
- name: Deploy to GH Pages | |
run: npm run deploy |