From 8af1f3da333a40f5b751394de1b203812fa37067 Mon Sep 17 00:00:00 2001 From: "deploybot2311[bot]" <159776436+deploybot2311[bot]@users.noreply.github.com> Date: Fri, 23 Feb 2024 08:38:38 +0000 Subject: [PATCH] Create new workflow file --- .github/workflows/docker.yml | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..c144272 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,40 @@ +name: Docker-CI/CD + +on: + push: + branches: + - main + - soc + pull_request: + branches: + - main + - soc +jobs: + deploy: + runs-on: ubuntu-latest + + env: + CI: false + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Docker Compose + run: | + cp .env.example .env + docker-compose -f docker-compose.yml up -d + + - name: Authenticate to Google Cloud + uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GCP_SA_KEY }} + + - name: Set up gcloud CLI + uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GCP_SA_KEY }} + + - name: SSH into the VM + run: + gcloud compute ssh ${{ secrets.GCP_INSTANCE_NAME}} --zone=${{ secrets.GCP_ZONE }} --command "rmdir SkillWell"