-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (65 loc) · 2.15 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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: false
jobs:
release:
name: Release
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Assign input version
if: github.event.inputs.version != null
run: echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
- uses: actions/github-script@v7
if: github.event.inputs.version == null
id: candidate-version
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
script: |
const list = await github.rest.repos.listReleases({
owner: "domaframework",
repo: "doma-compile-plugin",
});
console.log(list)
let version = list.data[0].name
return version.startsWith("v") ? version.substring(1) : version
- name: Assign candidate version
if: github.event.inputs.version == null
run: echo "RELEASE_VERSION=${{ steps.candidate-version.outputs.result }}" >> $GITHUB_ENV
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Release ${{ env.RELEASE_VERSION }}
run: |
java -version
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
./gradlew release -Prelease.releaseVersion=${{ env.RELEASE_VERSION }}
- name: Upload reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: build
path: ./**/build/reports