forked from wiremock/wiremock
-
Notifications
You must be signed in to change notification settings - Fork 33
82 lines (78 loc) · 2.62 KB
/
create-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
79
80
81
82
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Create Release
on:
push:
tags:
- "*-ui"
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
jdk: [ 11 ]
runs-on: ${{ matrix.os }}
env:
JDK_VERSION: ${{ matrix.jdk }}
outputs:
version: ${{ steps.vars.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set output
id: vars
run: |
echo "tag=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT
echo "version=$(echo $GITHUB_REF | cut -d / -f 3 | sed 's/.\{3\}$//')" >> $GITHUB_OUTPUT
- name: Check output
run: |
echo ${{ steps.vars.outputs.tag }}
echo ${{ steps.vars.outputs.version }}
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.jdk }}
distribution: 'temurin'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build
run: ./gradlew jar shadowJar
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.vars.outputs.tag }}
release_name: ${{ steps.vars.outputs.version }}
body_path: RELEASE-NOTES.md
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
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/wiremock-standalone-${{ steps.vars.outputs.version }}.jar
asset_name: wiremock-standalone-${{ steps.vars.outputs.version }}.jar
asset_content_type: application/java-archive
docker:
needs: [build]
uses: ./.github/workflows/docker-release.yml
with:
version: ${{ needs.build.outputs.version }}
secrets:
dockerUsername: ${{ secrets.DOCKERHUB_USERNAME }}
dockerToken: ${{ secrets.DOCKERHUB_TOKEN }}