AditiR-42 submitted a CI CD Action #57
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
name: Continuous Integration and Continuous Deployment | |
run-name: ${{ github.actor }} submitted a CI CD Action | |
on: | |
push: | |
branches: ["main"] | |
jobs: | |
Explore-GitHub-Actions: | |
if: contains(github.event.head_commit.message, '/deploy-app') | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "Comment ${{ github.event.head_commit.message }}" | |
- run: echo "Job was automatically triggered by a ${{ github.event_name }} event." | |
- run: echo "Job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- run: echo "Branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- id: 'auth' | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}' | |
- name: Configure Google Cloud S | |
uses: google-github-actions/setup-gcloud@v1 | |
- name: Configure Docker Client | |
run: |- | |
gcloud auth configure-docker | |
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." | |
- run: echo "🖥️ The workflow is now ready to test your code on the runner." | |
- name: List files in the repository | |
run: | | |
ls ${{ github.workspace }} | |
- name: Build Deployment Container | |
run: |- | |
cd ${{ github.workspace }}/src/deployment/ | |
docker build -t privasee-deployment -f Dockerfile . | |
- name: Run Deploy App | |
run: |- | |
docker run --rm --name privasee-deployment \ | |
-v /var/run/docker.sock:/var/run/docker.sock \ | |
-v $HOME/.ssh:/home/app/.ssh \ | |
-v ${{ github.workspace }}/src/api_service:/api-service \ | |
-v ${{ github.workspace }}/src/frontend-react:/frontend-react \ | |
-v ${{ github.workspace }}/src/models:/models \ | |
--volume $GITHUB_WORKSPACE:/workspace \ | |
--mount type=bind,source=$GOOGLE_APPLICATION_CREDENTIALS,target=/secrets/deployment.json \ | |
--env GOOGLE_APPLICATION_CREDENTIALS=/secrets/deployment.json \ | |
-e USE_GKE_GCLOUD_AUTH_PLUGIN=True \ | |
-e GCP_PROJECT=ac215-privasee \ | |
-e GCP_ZONE=us-central1-a \ | |
privasee-deployment sh deploy-k8s-update.sh |