forked from wiremock/wiremock
-
Notifications
You must be signed in to change notification settings - Fork 33
143 lines (126 loc) · 4.59 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# 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:
workflow_dispatch:
env:
SEMANTIC_RELEASE_VERSION: 23.0.6
SEMANTIC_RELEASE_EXEC_VERSION: 6.0.3
CONVENTIONAL_COMMITS_VERSION: 7.0.2
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: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache node modules
uses: actions/cache@v4
id: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-release-${{ env.SEMANTIC_RELEASE_VERSION }}-${{ env.SEMANTIC_RELEASE_EXEC_VERSION }}-${{ env.CONVENTIONAL_COMMITS_VERSION }}
- name: Install Dependencies
shell: bash
run: |
#!/bin/bash
npm install -g semantic-release@${{ env.SEMANTIC_RELEASE_VERSION }} \
@semantic-release/exec@${{ env.SEMANTIC_RELEASE_EXEC_VERSION }} \
conventional-changelog-conventionalcommits@${{ env.CONVENTIONAL_COMMITS_VERSION }}
- name: Determine Semver & Update PRs and Issues
id: semver
env:
GH_TOKEN: ${{ github.token }}
FORCE_COLOR: 1
DEBUG_COLORS: 1
run: |
#!/bin/bash
semantic-release --debug
- name: Set up JDK
uses: actions/setup-java@v4
if: steps.semver.outputs.version != ''
with:
java-version: ${{ matrix.jdk }}
distribution: 'temurin'
- name: Grant execute permission for gradlew
if: steps.semver.outputs.version != ''
run: chmod +x gradlew
- name: Cache Gradle packages
uses: actions/cache@v4
if: steps.semver.outputs.version != ''
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build
if: steps.semver.outputs.version != ''
run: ./gradlew jar shadowJar -PprojVersion=${{ steps.semver.outputs.version }}
- name: Create Release
id: create-release
shell: bash
if: steps.semver.outputs.version != ''
env:
GH_TOKEN: ${{ github.token }}
run: |
#!/bin/bash
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/releases \
-f tag_name='${{ steps.semver.outputs.version }}' \
-f target_commitish='${{ github.sha }}' \
-f name='${{ steps.semver.outputs.version }}' \
-F draft=false \
-F prerelease=false \
-F generate_release_notes=true
- name: Upload Release Asset
id: upload-release-asset
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
gh release upload ${{ steps.semver.outputs.version }} ./build/libs/wiremock-standalone-${{ steps.semver.outputs.version }}.jar#wiremock-standalone-${{ steps.semver.outputs.version }}.jar
# - 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 }}