-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from bounswe/devops/feature/119-backend-githu…
…b-actions Devops/feature/119 backend GitHub actions
- Loading branch information
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
||
|