Skip to content

Commit

Permalink
Merge pull request #16 from Hack-Weekly/feat-github-action
Browse files Browse the repository at this point in the history
Added CICD for the webapp
  • Loading branch information
lly02 authored Aug 16, 2023
2 parents 57d7a00 + 8d8eae5 commit 89bc672
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 3 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Deploy React with GitHub Pages dependencies preinstalled

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./sudoku-app
strategy:
matrix:
node-version: [18.x]

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: sudoku-app/package-lock.json
- name: Build
env:
CI: false
run: |
npm ci
npm run build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload dist repository
path: './sudoku-app/build'

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
25 changes: 22 additions & 3 deletions sudoku-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions sudoku-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "sudoku-app",
"type": "module",
"version": "0.1.0",
"homepage": "https://hack-weekly.github.io/sage-giraffe-sudoku",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
Expand Down Expand Up @@ -39,6 +40,7 @@
]
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"gh-pages": "^6.0.0"
}
}

1 comment on commit 89bc672

@vercel
Copy link

@vercel vercel bot commented on 89bc672 Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sage-giraffe-sudoku – ./sudoku-app

sage-giraffe-sudoku-git-main-sagegiraffe.vercel.app
sage-giraffe-sudoku-sagegiraffe.vercel.app
sage-giraffe-sudoku-delta.vercel.app

Please sign in to comment.