-
Notifications
You must be signed in to change notification settings - Fork 2
70 lines (53 loc) · 2.45 KB
/
gradle-publish.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: Java CI with Gradle
on:
push:
branches: [ "master" ]
jobs:
build:
environment: aws
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
- name: Create application.yml files
run: |
mkdir -p ${{ secrets.APPLICATION_PATH }}/yaml
echo "${{ secrets.APPLICATION_YML }}" > ${{ secrets.APPLICATION_PATH }}/application.yml
echo "${{ secrets.APPLICATION_PROD_YML }}" > ${{ secrets.APPLICATION_PATH }}/yaml/application-prod.yml
echo "${{ secrets.APPLICATION_DEV_YML }}" > ${{ secrets.APPLICATION_PATH }}/yaml/application-dev.yml
echo "${{ secrets.APPLICATION_OAUTH_YML }}" > ${{ secrets.APPLICATION_PATH }}/yaml/application-oauth.yml
echo "${{ secrets.APPLICATION_TEST_YML }}" > ${{ secrets.APPLICATION_TEST_PATH }}/application-test.yml
- name: Build with Gradle Wrapper
run: ./gradlew clean build -Pspring.profiles.active=test
- name: AWS credential
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_NAME }}
role-session-name: GithubActions
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: S3 upload
run: aws deploy push --application-name ${{ secrets.AWS_CODE_DEPLOY_APPLICATION }} --ignore-hidden-files --s3-location s3://${{ secrets.AWS_S3_BUCKET }}/cicd/$GITHUB_SHA.zip --source .
- name: CodeDeploy
run: aws deploy create-deployment --application-name ${{ secrets.AWS_CODE_DEPLOY_APPLICATION }} --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name ${{ secrets.AWS_CODE_DEPLOY_GROUP }} --s3-location bucket=${{ secrets.AWS_S3_BUCKET }},key=cicd/$GITHUB_SHA.zip,bundleType=zip
dependency-submission:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0