Skip to content

Commit

Permalink
Merge pull request #8 from SE-LAB-Summer-2024/4-adding-auto-deployment
Browse files Browse the repository at this point in the history
DEBUG: modify the action file
  • Loading branch information
mohammadreza-pr authored Jul 7, 2024
2 parents 478c8a7 + 0d0768e commit 038f36f
Showing 1 changed file with 27 additions and 44 deletions.
71 changes: 27 additions & 44 deletions .github/workflows/main.yml
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 }}

0 comments on commit 038f36f

Please sign in to comment.