Skip to content

Commit

Permalink
Update cicd.yml
Browse files Browse the repository at this point in the history
Set up the ci cd workflow to use secrets for database user and database password
  • Loading branch information
kmaxii authored Jul 10, 2024
1 parent e16f3f8 commit 1fb4cfa
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- docker

jobs:
build:
build-and-deploy:
runs-on: ubuntu-latest

steps:
Expand All @@ -22,17 +22,26 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push Docker image
- name: Build Docker image
id: build
run: |
docker buildx build --platform linux/amd64 --push -t ${{ secrets.DOCKER_HUB_USERNAME }}/vow-website:latest .
- name: Deploy to Oracle Cloud
if: success()
env:
OCI_CLI_AUTH: instance_principal
DB_ROOT_PASSWORD: ${{ secrets.DB_ROOT_PASSWORD }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
run: |
ssh -i ${{ secrets.ORACLE_CLOUD_SSH_PRIVATE_KEY }} ${{ secrets.ORACLE_CLOUD_SSH_USER }}@${{ secrets.ORACLE_CLOUD_IP }} << EOF
cd /path/to/your/project
git pull origin master
docker compose down
export DB_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
export DB_USER=${DB_USER}
export DB_PASSWORD=${DB_PASSWORD}
docker compose pull
docker compose up -d
EOF

0 comments on commit 1fb4cfa

Please sign in to comment.