Skip to content

Commit

Permalink
Merge pull request #132 from bounswe/devops/feature/119-backend-githu…
Browse files Browse the repository at this point in the history
…b-actions

Devops/feature/119 backend GitHub actions
  • Loading branch information
atakanyasar authored May 10, 2024
2 parents f3ff820 + 1cce7c1 commit 69af42c
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/backend_deploy_staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: backend-staging-workflow

on:
workflow_run:
workflows: ["backend-test"]
types:
- completed
push:
branches:
- staging
paths:
- 'backend/**'
- compose.yml

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Authorize to with doctl
run: echo ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | doctl auth init --context github-actions

- name: Login to Docker registry
run: doctl registry login --context github-actions

- name: Build Docker image
run: docker compose 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

32 changes: 32 additions & 0 deletions .github/workflows/backend_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: backend-test

on:
push:
paths:
- 'backend/**'
- compose.yml
- dev.yml
- '.github/workflows/backend_test.yml'

pull_request:
branches:
- main
- staging
- develop


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 dev.yml run --rm backend mvn test



0 comments on commit 69af42c

Please sign in to comment.