forked from mkyong/spring3-mvc-maven-xml-hello-world
-
Notifications
You must be signed in to change notification settings - Fork 306
33 lines (29 loc) · 1011 Bytes
/
main.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
name: TERRAFORM PROJ
on:
push:
# branches: [ master ]
tags:
- v.**
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Build with Maven
run: mvn package
- name: Set Relase version
id: vars
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: build docker image and push to ecr repo
run: |
$(aws ecr get-login --no-include-email --region ap-south-1)
docker build -t ${{ secrets.ECR_REPO_NAME }}/spring:${{ env.RELEASE_VERSION }} .
docker push ${{ secrets.ECR_REPO_NAME }}/spring:${{ env.RELEASE_VERSION }}
env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ap-south-1
- name: terraform init
run: cd devops && terraform init
- name: terraform apply
run : cd devops && terraform apply -var="tag=${{ env.RELEASE_VERSION }}" -auto-approve