-
Notifications
You must be signed in to change notification settings - Fork 31
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
[CI-CD] GitHub Action #270
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
224aa24
create GitHub action for platform deployment
danielogen cae78ed
update action name
danielogen 8a605ea
create deployment actions
danielogen 9c76f3b
update login to k8s
danielogen 7544185
update log messages
danielogen fe2e356
update dockerignore file to test pipeline
danielogen 410243c
update gcr secret
danielogen 735f230
test actions
danielogen e085f48
more testing
danielogen 0a5b45a
updated
danielogen 7b02a4e
more update
danielogen 4c9c496
update docker ignore
danielogen 913ddc8
update paths
danielogen 63b971e
update docker file
danielogen 8ed1201
add --file flage
danielogen 630f559
update dockerignore file
danielogen d5a959d
correct sp
danielogen d56034f
update dockerignore
danielogen 8b19d77
run only when PR is merged
danielogen 96c7459
add production action
danielogen 2a06219
undo changes in docker file
danielogen fca5a03
set branch to dev
danielogen 6bd3e06
add config to build react app
danielogen 06de5c7
test frontend staging
danielogen 86fad55
test platform deployment
danielogen 90890a0
test platform deployment
danielogen 230f293
update path to imports
danielogen 78fabb3
update import path
danielogen db9521b
update staging pipeline
danielogen beacb45
update production pipeline
danielogen d0bb922
set NODE_PATH
danielogen c381541
set NODE_PATH
danielogen e1f2a40
set NODE_PATH
danielogen a096612
set CI env to false
danielogen b94184f
update pipeline
danielogen a731a58
undo changes to import
danielogen 90dc8a5
update pipeline
danielogen d5f2d14
test pipeline
danielogen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,82 @@ | ||
name: deploy-platform-production | ||
|
||
on: | ||
#push: | ||
pull_request: | ||
branches: master | ||
types: [closed] | ||
jobs: | ||
check: | ||
if: github.event.pull_request.merged == 'true' | ||
#if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true | ||
name: check for changes in platform | ||
outputs: | ||
run_job: ${{ steps.check_files.outputs.run_job }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: check modified files | ||
id: check_files | ||
run: | | ||
echo "=============== list modified files ===============" | ||
git diff --name-only HEAD^ HEAD | ||
|
||
echo "========== check paths of modified files ==========" | ||
git diff --name-only HEAD^ HEAD > files.txt | ||
|
||
echo "::set-output name=run_job::false" | ||
|
||
while IFS= read -r file | ||
do | ||
echo $file | ||
if [[ $file == netmanager/* ]]; then | ||
echo "::set-output name=run_job::true" | ||
fi | ||
done < files.txt | ||
|
||
build: | ||
name: build-push-deploy | ||
needs: check | ||
if: needs.check.outputs.run_job == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to GCR | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ${{ secrets.REGISTRY_URL }} | ||
username: _json_key | ||
password: ${{ secrets.GCR_CONFIG }} | ||
|
||
- name: Login to K8S | ||
uses: azure/k8s-set-context@v1 | ||
with: | ||
method: kubeconfig | ||
kubeconfig: ${{ secrets.K8S_CONFIG }} | ||
|
||
- name: NPM Build | ||
run: | | ||
cd netmanager/ | ||
export NODE_PATH=src/ | ||
npm install | ||
npm audit fix | ||
CI=false npm run build | ||
|
||
- name: Build and Push Docker Image | ||
run: | | ||
cd netmanager/ | ||
docker build --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-platform-frontend:latest . | ||
docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-platform-frontend:latest | ||
- name: Deploy to K8S | ||
run: | | ||
cd k8s/ | ||
kubectl apply -f airqo-platform-frontend.yaml | ||
kubectl rollout restart deployment/airqo-platform-frontend -n production | ||
|
||
|
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,83 @@ | ||
name: deploy-platform-staging | ||
|
||
on: | ||
push: | ||
#pull_request: | ||
branches: ft-deploy-platform | ||
#types: [closed] | ||
jobs: | ||
check: | ||
#if: github.event.pull_request.merged == 'true' | ||
#if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true | ||
name: check for changes in platform | ||
outputs: | ||
run_job: ${{ steps.check_files.outputs.run_job }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: check modified files | ||
id: check_files | ||
run: | | ||
echo "=============== list modified files ===============" | ||
git diff --name-only HEAD^ HEAD | ||
|
||
echo "========== check paths of modified files ==========" | ||
git diff --name-only HEAD^ HEAD > files.txt | ||
|
||
echo "::set-output name=run_job::false" | ||
|
||
while IFS= read -r file | ||
do | ||
echo $file | ||
if [[ $file == netmanager/* ]]; then | ||
echo "::set-output name=run_job::true" | ||
break | ||
fi | ||
done < files.txt | ||
|
||
build: | ||
name: build-push-deploy-netmanager | ||
needs: check | ||
if: needs.check.outputs.run_job == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to GCR | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ${{ secrets.REGISTRY_URL }} | ||
username: _json_key | ||
password: ${{ secrets.GCR_CONFIG }} | ||
|
||
- name: Login to K8S | ||
uses: azure/k8s-set-context@v1 | ||
with: | ||
method: kubeconfig | ||
kubeconfig: ${{ secrets.K8S_CONFIG }} | ||
|
||
- name: NPM Build | ||
run: | | ||
cd netmanager/ | ||
export NODE_PATH=src/ | ||
npm install | ||
npm audit fix | ||
CI=false npm run build | ||
|
||
- name: Build and Push Docker Image | ||
run: | | ||
cd netmanager/ | ||
docker build --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-platform-frontend:latest . | ||
docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-platform-frontend:latest | ||
- name: Deploy to K8S | ||
run: | | ||
cd k8s/ | ||
kubectl apply -f stage-airqo-platform-frontend.yaml | ||
kubectl rollout restart deployment/airqo-stage-platform-frontend -n staging | ||
|
||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering, aren't we able to reuse the same configuration file for multiple environments? @danielogen
But I guess it is not yet possible as seen here: actions/starter-workflows#245