-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (61 loc) · 2.17 KB
/
ci-cd-develop.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
72
73
name: ci-cd develop
on:
push:
branches:
- develop
pull_request:
types: [ closed ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: checkout source code
uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.ACTION_SECRETS}}
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
- name: copy application.yml files from submodule
run: |
mkdir -p src/main/resources
cp -r BE-hubo-gillajabi-resources/resources/application*.yml src/main/resources/
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: bootJar with gradle
run: ./gradlew bootJar
- name: update release
uses: release-drafter/release-drafter@v6
with:
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.ACTION_SECRETS }}
prerelease-identifier: 'dev'
- name: set docker tag
id: docker_tag
run: |
if [ "${{ github.event_name }}" == "push" ]; then
TAG=$(curl -sH "Authorization: token ${{ secrets.ACTION_SECRETS }}" \
https://api.github.com/repos/${{ github.repository }}/releases?per_page=1 | jq -r 'map(select(.draft == true)) | .[0].tag_name')
if [ "$TAG" == "null" ]; then
TAG="${{ github.sha }}"
fi
elif [ "${{ github.event_name }}" == "release" ]; then
TAG="${{ github.event.release.tag_name }}"
else
TAG="latest"
fi
echo "TAG=$TAG" >> $GITHUB_ENV
- name: docker login
uses: docker/login-action@v3.1.0
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_LOGIN_TOKEN }}
- name: build and push docker image
run: |
docker build -f Dockerfile-dev --platform linux/arm64/v8 -t ${{ secrets.DOCKER_HUB_USERNAME }}/${{ secrets.PROJECT_NAME }}:$TAG .
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/${{ secrets.PROJECT_NAME }}:$TAG