tweaks to actions #3
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 GitHub Pages | |
# Trigger this workflow when a push is made to the master branch | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
update-pages: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up Node.js | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.11.1' # TODO: nix! reproducible builds! & a sprinkle of professionalism | |
# Step 3: Merge master into github_pages | |
- name: Merge master into github_pages | |
run: | | |
git fetch origin | |
git checkout github_pages_test | |
git reset --hard origin/master | |
# Step 4: Install dependencies and build the project | |
- name: Install dependencies and build | |
working-directory: ./svelte_blinkenweb | |
run: | | |
npm ci | |
npm run build | |
# Step 5: Remove the content of /docs | |
- name: Remove old /docs content | |
run: | | |
rm -rf ./docs/* | |
# Step 6: Copy new build to /docs | |
- name: Copy build to /docs | |
run: | | |
cp -r ./svelte_blinkenweb/build/* ./docs/ | |
# Step 7: Commit and push the changes | |
- name: Commit and push changes | |
run: | | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "Update GitHub Pages with latest build from master" | |
git push origin github_pages_test --force | |