Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devops/feature/119 backend GitHub actions #132

Merged
merged 14 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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