-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from SE-LAB-Summer-2024/4-adding-auto-deployment
DEBUG: modify the action file
- Loading branch information
Showing
1 changed file
with
27 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,38 @@ | ||
name: GH Pages Deploy | ||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | ||
|
||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths-ignore: | ||
- "*.md" | ||
|
||
branches: [ "main" ] | ||
pull_request: | ||
branches: [main] | ||
paths-ignore: | ||
- "*.md" | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build-deploy: | ||
name: Build and deploy app | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
working-directory: ./app | ||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
|
||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@master | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Get yarn cache | ||
id: yarn-cache | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
||
- uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.yarn-cache.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }} # TODO: Use yarn.lock instead, if that file exists in your repo. | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install dependencies 🔧 | ||
run: yarn install | ||
|
||
- name: Test 🚨 | ||
run: yarn test | ||
|
||
- name: Build 🏗️ | ||
run: yarn build | ||
|
||
- name: Deploy to GH Pages 🚀 | ||
if: ${{ github.event_name != 'pull_request' }} | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: /build | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- run: npm ci | ||
- run: npm run build --if-present | ||
- run: npm test | ||
|
||
- name: Deploy with gh-pages | ||
run: | | ||
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | ||
npm run deploy -- -u "github-actions-bot <[email protected]>" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |