Skip to content

Instantly share code, notes, and snippets.

@FazioNico
Created September 25, 2023 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FazioNico/10f11de9c46e80a344984e54a7c5b2d9 to your computer and use it in GitHub Desktop.
Save FazioNico/10f11de9c46e80a344984e54a7c5b2d9 to your computer and use it in GitHub Desktop.
[For Students] Github Action that deploy to Github Pages
name: Deploy Github Page
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
# - run: npm test
- run: npm run deploy:github --if-present
env:
CI: true
# Deploy env
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} #
@FazioNico
Copy link
Author

Usage

  • copy file
  • paste at this path: ./.github/workflows/deploy-ghp.yml
  • add script to package.json:
 "deploy:github": "ng deploy --base-href=/<repository-name>/ --repo=<repository-address>.git --name=<your-name> --email=<your-email> --no-silent",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment