-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (58 loc) · 1.64 KB
/
deploy-spring-webmvc.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: spring-webmvc - Build and Deploy
on:
push:
paths:
- spring-webmvc/**
- .github/workflows/deploy-spring-webmvc.yml
workflow_dispatch: # Enables triggering the workflow manually from the Actions tab
permissions:
id-token: write
contents: read
checks: write
env:
WORKDIR: spring-webmvc
IMAGE_NAME: spring-webmvc
#defaults:
# run:
# shell: bash
# working-directory: ${{ env.WORKDIR }}
jobs:
build:
name: Build and Push
runs-on: ubuntu-latest
outputs:
pushed-image-tag: ${{ steps.ecr-push.outputs.image-tag }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Gradle Build
uses: ./.github/actions/gradle-build
- name: Docker Build
uses: ./.github/actions/docker-build
with:
image-name: ${{ env.IMAGE_NAME }}
- name: ECR Push
id: ecr-push
uses: ./.github/actions/ecr-push
with:
image-name: ${{ env.IMAGE_NAME }}
aws-role: ${{ vars.AWS_ROLE }}
aws-region: ${{ vars.AWS_REGION }}
deploy:
name: Deploy with ArgoCD
runs-on: ubuntu-latest
environment: dev
needs: build
if: success() && github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Deploy
id: argocd-deploy
uses: ./.github/actions/argocd-deploy
with:
argocd-url: ${{ vars.ARGOCD_URL }}
argocd-user: ${{ vars.ARGOCD_USER }}
argocd-password: ${{ secrets.ARGOCD_PASSWORD }}
argocd-app-name: ${{ env.IMAGE_NAME }}
image-tag: ${{ needs.build.outputs.pushed-image-tag }}