Skip to content

Commit 69af42c

Browse files
authored
Merge pull request #132 from bounswe/devops/feature/119-backend-github-actions
Devops/feature/119 backend GitHub actions
2 parents f3ff820 + 1cce7c1 commit 69af42c

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: backend-staging-workflow
2+
3+
on:
4+
workflow_run:
5+
workflows: ["backend-test"]
6+
types:
7+
- completed
8+
push:
9+
branches:
10+
- staging
11+
paths:
12+
- 'backend/**'
13+
- compose.yml
14+
15+
jobs:
16+
deploy:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Authorize to with doctl
23+
run: echo ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | doctl auth init --context github-actions
24+
25+
- name: Login to Docker registry
26+
run: doctl registry login --context github-actions
27+
28+
- name: Build Docker image
29+
run: docker compose build
30+
31+
- name: Tag Docker image
32+
run: docker tag bounswe2024group1-backend:latest registry.digitalocean.com/semantic-browse/backend-staging:latest
33+
34+
- name: Push Docker image
35+
run: docker push registry.digitalocean.com/semantic-browse/backend-staging:latest
36+

.github/workflows/backend_test.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: backend-test
2+
3+
on:
4+
push:
5+
paths:
6+
- 'backend/**'
7+
- compose.yml
8+
- dev.yml
9+
- '.github/workflows/backend_test.yml'
10+
11+
pull_request:
12+
branches:
13+
- main
14+
- staging
15+
- develop
16+
17+
18+
jobs:
19+
test:
20+
runs-on: ubuntu-latest
21+
env:
22+
working-directory:
23+
backend
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Test with Maven
29+
run: docker compose -f dev.yml run --rm backend mvn test
30+
31+
32+

0 commit comments

Comments
 (0)