Github workflow to deploy to github pages.

I recently set up an angular application and pushed it to Github. I had seen others use github pages to show their application and so wondered if I could do the same. Here is the config that worked well for me!

You can see the implementation here:

GitHub – jcianci12/GeoJSON-Styler: An application used for styling GeoJSON by mapping style rules to CSV data.

The application is hosted here:

GeoJson-Styler (jcianci12.github.io)

Credit goes to James for setting up the github action which can be found here:

JamesIves/github-pages-deploy-action: Automatically deploy your project to GitHub Pages using GitHub Actions. This action can be configured to push your production-ready code into any branch you’d like.

on: push
name: Build Angular
jobs:
  build-and-deploy:
    concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
    runs-on: ubuntu-latest
    steps:
      - name: Checkout 🛎️
        uses: actions/checkout@v3
      - name: Use Node 16.x
        uses: actions/setup-node@v1
        with:
          node-version: '16.x'
      - name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
        run: |
          npm i
          npm run githubbuild
      - name: Deploy 🚀
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          folder: dist # The folder the action should deploy.

I hope this helps you with deploying your Angular application to github pages.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *