Skip to content

Commit

Permalink
chore(devops): auto-deploy backend staging
Browse files Browse the repository at this point in the history
  • Loading branch information
atakanyasar committed May 6, 2024
1 parent 1849dd7 commit 615cb03
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/backend_deploy_staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: backend-staging-workflow

on:
push:
branches:
- staging
paths:
- 'backend/**'
- docker-compose.yml

jobs:
test:
runs-on: ubuntu-latest
env:
working-directory: backend
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Test with Maven
run: docker compose -f docker-compose.dev.yml run --rm backend-dev mvn test

deploy:
needs: test
runs-on: ubuntu-latest
env:
working-directory: backend
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

- name: Build Docker image
run: docker compose -f docker-compose.yml build

- name: Tag Docker image
run: docker tag bounswe2024group1-backend:latest registry.digitalocean.com/semantic-browse/backend-staging:latest

- name: Push Docker image
run: docker push registry.digitalocean.com/semantic-browse/backend-staging:latest

1 comment on commit 615cb03

@atakanyasar
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Login to docker will be updated.

Please sign in to comment.