Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fredrick/issue 314/git action integration #346

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Changes from 9 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5b5ffd8
Create backend.yml
iamfredrickokereke Mar 7, 2021
7dcac5e
Merge pull request #1 from iamfredrickokereke/iamfredrickokereke-patch-1
iamfredrickokereke Mar 8, 2021
1f0a03c
Create azure.yml
iamfredrickokereke Mar 8, 2021
89f1215
Update backend.yml
iamfredrickokereke Mar 8, 2021
0bcef7c
improved ci with actions
iamfredrickokereke Mar 8, 2021
7ad22c5
improved comment
iamfredrickokereke Mar 9, 2021
e8d491c
improved the action and comment description
iamfredrickokereke Mar 9, 2021
9c17a85
updated secrets and node version
iamfredrickokereke Jun 7, 2021
1111eb2
removed declared env variable
iamfredrickokereke Jun 7, 2021
573edbc
refactored according to suggested changes in comment
iamfredrickokereke Jun 19, 2021
d0e35cc
fixed an omission
iamfredrickokereke Jun 19, 2021
e09ab9b
Merge branch 'TheIOFoundation:master' into fredrick/issue-314/git-act…
iamfredrickokereke Jun 21, 2021
24dcca2
Update backend.yml
iamfredrickokereke Jun 21, 2021
6a7e8c7
removed secrets
iamfredrickokereke Jun 21, 2021
961765b
Update backend.yml
iamfredrickokereke Jun 21, 2021
40b0436
added npm build and test setup
iamfredrickokereke Jun 22, 2021
6a22b8c
added and updated package.json file
iamfredrickokereke Jun 23, 2021
3daccc6
updated node version
iamfredrickokereke Jun 23, 2021
a545357
Update package.json
iamfredrickokereke Jun 23, 2021
da401ff
cleared npm cache
iamfredrickokereke Jun 23, 2021
0810ad2
old entry removed and package.json file updated to version 2.0.0 from…
iamfredrickokereke Jun 23, 2021
ce0ab0f
removed the package.json files outside API directory
iamfredrickokereke Jun 28, 2021
8f1a102
added passWithNoTest Flag
iamfredrickokereke Jun 28, 2021
65c3eff
removed the push to master if check
iamfredrickokereke Jun 28, 2021
674f55d
added deploy to azure actions with secret variable
iamfredrickokereke Jun 28, 2021
f5bcae8
Merge branch 'master' into fredrick/issue-314/git-action-integration
iamfredrickokereke Jun 28, 2021
976b18c
added the if clause to push to master
iamfredrickokereke Jun 30, 2021
bf2b1c0
Update backend.yml
iamfredrickokereke Jun 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This is a basic workflow to help deploy the backend code to Azure server
# it triggers on push and pull request events to the master branch
# it runs the jobs on the API/ directory and deploys using secret credentials
# Update the secret credentials with details from the Azure web server.

name: "CI/CD Pipeline for Azure webapp deployment"

on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- master
jobs:
build_and_deploy:
name: Build test and Deploy Node App to Azure
runs-on: ubuntu-latest
if: >-
github.event_name == 'push' || (github.event_name == 'pull_request' &&
github.event.action != 'closed')
environment: production
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "14.x"
- name: npm install, build, and test
run: |
pwd
ls
jeff-knurek marked this conversation as resolved.
Show resolved Hide resolved
cd API/
npm install
npm run build --if-present
npm run test --if-present
echo Successful
- name: "Deploy to Azure"
uses: azure/webapps-deploy@v2
with:
app-name: ${{ secrets.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: ${{ secrets.AZURE_WEBAPP_PACKAGE_PATH }}
- if: github.ref == 'refs/heads/master' && job.status == 'success'
run: |
git push -u origin HEAD:master -f
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is interesting. it deploys in the previous step, and if successful auto-merges the code. but i don't think I like that approach. I'd rather only deploy if it is master. so maybe better to move this if statement to the previous deploy step, and so that we only deploy after the PR is closed and merged to master