-
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 #3 from atlp-rwanda/ft-ci/cd
Ft ci/cd
- Loading branch information
Showing
2 changed files
with
80 additions
and
0 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 |
---|---|---|
@@ -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 }}' | ||
}) |
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 |
---|---|---|
@@ -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 |