GitHub Actions (static apps, vue, react, svelte, angular, alpine)

JS
R
JavaScript

Quick reference for deploying static web apps using GitHub Actions across popular JavaScript frameworks. Streamlines CI/CD workflows for frontend projects.

1name: Deploy to Github Pages
2  on:
3    push:
4      branches:
5        - main
6  jobs:
7    gh-pages-deploy:
8      name: Deploying to Github Pages
9      runs-on: ubuntu-latest
10      steps:
11          - uses: actions/checkout@v2
12          - uses: actions/setup-node@v2
13            with:
14              node-version: '12'
15          - name: Install packages
16            run: npm i
17          - name: Set Creds
18            run: git config user.name "user" && git config user.email "user@email.com"
19          - name: Deploy
20            run: npm run gh-pages-deploy
21          - name: Change branch
22            run: git checkout gh-pages
23          - name: Create CNAME
24            run: echo "recipes.coding-cloud.com" > CNAME
25          - name: Create 404
26            run: cp index.html 404.html
27          - name: Push new files
28            run: git add CNAME 404.html && git commit -m "Update CNAME" && git push

Created on 1/18/2022