-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (60 loc) · 2.58 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
71
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
name: THT ChatServer
run-name: ${{ github.actor }} is learning GitHub Actions
on:
push:
branches:
- main
# env:
# DEPLOY_FILE_NAME: deployfile-`date +%Y%m%d.%H%M%S`
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: CheckOut
uses: actions/checkout@v4
with:
token: ${{ secrets.ACTION_TOKEN }}
submodules: true
- name: Set up JDK 17
uses:
actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Setup Gradle
uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0
- name: Build with Gradle
run: ./gradlew clean build
- name: Make Zip File
id: file
run: name = zip -qq -r ./deployfile-`date +%Y%m%d.%H%M%S`.zip . >> "$GITHUB_OUTPUT"
shell: bash
- name: AWS credential
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ secrets.AWS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Upload to AWS S3
run: aws s3 cp ./${{ steps.file.outputs.name }}.zip s3://${{ secrets.S3_DEPLOY_BUCKET }}/${{ steps.file.outputs.name }}.zip
# - name: Deploy EC2
# run: aws deploy create-deployment --application-name ${{ env.AWS_CODE_DEPLOY_APPLICATION }} --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name ${{ env.AWS_CODE_DEPLOY_GROUP }} --s3-location bucket=$AWS_S3_BUCKET,key=cicdtest/$GITHUB_SHA.zip,bundleType=zip
#
# # The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# # the publishing section of your build.gradle
# - name: Publish to GitHub Packages
# run: ./gradlew publish
# env:
# USERNAME: ${{ github.actor }}
# TOKEN: ${{ secrets.GITHUB_TOKEN }}