Skip to content

Commit

Permalink
Merge pull request #3 from atlp-rwanda/ft-ci/cd
Browse files Browse the repository at this point in the history
Ft ci/cd
  • Loading branch information
David-Neza authored Jul 17, 2024
2 parents f3548ba + b7d062b commit 4d1bb3d
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Continuous Deployment

env:
VERCEL_ORG_ID: ${{secrets.VERCEL_ORG_ID}}
VERCEL_PROJECT_ID: ${{secrets.VERCEL_PROJECT_ID}}

on:
workflow_dispatch:
pull_request:
branches:
- develop
permissions:
contents: read
pull-requests: write
jobs:
Test_Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: npm install
- name: Run test
run: npm run test --if-present
- name: Build
run: npm run build

Deploy-Preview:
runs-on: ubuntu-latest
needs: [Test_Build]
steps:
- uses: actions/checkout@v2
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Info
run: vercel pull --yes --environment=preview --token=${{secrets.VERCEL_TOKEN}}
- name: Build Project Artifacts
run: vercel build --token=${{secrets.VERCEL_TOKEN}}
- name: Deploy Project Artifacts to Vercel
id: deploy
run: echo "url=$(vercel deploy --prebuilt --token=${{secrets.VERCEL_TOKEN}})" >> $GITHUB_OUTPUT

- name: Comment PR
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Vercel preview deployment is live at: ${{ steps.deploy.outputs.url }}'
})
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Continous Integration

on:
workflow_dispatch:
push:
branches-ignore:
- develop

jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Packages
run: npm install
- name: Build
run: npm run build

Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Packages
run: npm install
- name: Run tests
run: npm run test --if-present

0 comments on commit 4d1bb3d

Please sign in to comment.