-
Notifications
You must be signed in to change notification settings - Fork 90
78 lines (66 loc) · 2.45 KB
/
release.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
74
75
76
77
78
name: Release
on:
push:
branches:
- "!*"
tags:
- "*"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 21
- name: Get version number
id: get_version
run: echo ::set-output name=APP_VERSION::${GITHUB_REF#refs/tags/}
- name: Build with Gradle
run: ./gradlew build jacocoTestReport sonarqube --info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
- name: Create Release Notes
id: release_notes
uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{ steps.release_notes.outputs.changelog }}
draft: false
prerelease: false
- name: Upload application jar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/libs/fake-smtp-server-${{ steps.get_version.outputs.APP_VERSION }}.jar
asset_name: fake-smtp-server-${{ steps.get_version.outputs.APP_VERSION }}.jar
asset_content_type: application/java-archive
- name: Upload sources jar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/libs/fake-smtp-server-${{ steps.get_version.outputs.APP_VERSION }}-sources.jar
asset_name: fake-smtp-server-${{ steps.get_version.outputs.APP_VERSION }}-sources.jar
asset_content_type: application/java-archive
- name: Setup Login to DockerHub
run: |
sed -i 's/docker_hub_username/${{ secrets.DOCKERHUB_USERNAME }}/' ./gradle.properties
sed -i 's/docker_hub_token/${{ secrets.DOCKERHUB_TOKEN }}/' ./gradle.properties
- name: Build and Push docker images
run: ./gradlew jib