Skip to content

Commit

Permalink
feat: added CI & CD, and docs deploy actions (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimezesinachi authored Apr 11, 2024
1 parent ab017e7 commit 4a6bbef
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 2 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Continuous Deployment

on:
push:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up database
run: |
chmod +x ./setup-db.bash
./setup-db.bash
- name: Cache yarn dependencies
uses: actions/cache@v2
with:
path: |
**/node_modules
.yarn/cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn install

- name: Run CI tasks
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn ci

- name: Publish package to NPM
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn pub
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Continuous Integration

on:
push:
branches: [master]
pull_request:
branches: [master]

Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy documentation to GitHub Pages

on:
push:
branches:
- master
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on

jobs:
build:
name: Build Docusaurus
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build website
run: yarn build

- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3
with:
path: build

deploy:
name: Deploy to GitHub Pages
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 4a6bbef

Please sign in to comment.