From 302106a1eb636e5c358303ea41c7385776236e50 Mon Sep 17 00:00:00 2001 From: Ronan Connolly Date: Mon, 29 Apr 2024 16:57:56 +0200 Subject: [PATCH] Setup GitHub actions to deploy to GitHub Pages --- .github/workflows/main.yaml | 30 ++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 31 insertions(+) create mode 100644 .github/workflows/main.yaml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..0c29259 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,30 @@ +name: Build and Deploy +on: + push: + branches: + - main # change this to your default branch name if it's not 'main' + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 20 + + - name: Install Dependencies + run: npm ci + + - name: Build + run: npm run build:prod + + - name: Deploy + uses: JamesIves/github-pages-deploy-action@4.1.5 + with: + branch: gh-pages # The branch the action should deploy to. + folder: dist/chuck-norris-joke-generator # The folder the action should deploy. + token: ${{ secrets.GH_TOKEN }} # The GitHub token. diff --git a/package.json b/package.json index 4d48f42..c4610c6 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "ng": "ng", "start": "ng serve", "build": "ng build", + "build:prod": "ng build --configuration=production --base-href=/chuck-norris-joke-generator/", "watch": "ng build --watch --configuration development", "test": "ng test" },