1313 runs-on : ubuntu-latest
1414
1515 steps :
16+ - name : Assign input version
17+ if : github.event.inputs.version != null
18+ run : echo "RELEASE_VERSION=${{ github.event.inputs.version }}"" >> $GITHUB_ENV
19+
20+ - uses : actions/github-script@v3
21+ if : github.event.inputs.version == null
22+ id : candidate-version
23+ with :
24+ github-token : ${{secrets.GITHUB_TOKEN}}
25+ result-encoding : string
26+ script : |
27+ const list = await github.repos.listReleases({
28+ owner: "domaframework",
29+ repo: "sandbox",
30+ });
31+ console.log(list)
32+ return list.data[0].name
33+
34+ - name : Assign candidate version
35+ if : success()
36+ run : echo "RELEASE_VERSION=${{ steps.candidate-version.outputs.result }}"" >> $GITHUB_ENV
37+
1638 - name : Set up JDK 8
1739 uses : actions/setup-java@v1
1840 with :
@@ -36,30 +58,12 @@ jobs:
3658 restore-keys : |
3759 ${{ runner.os }}-gradle-
3860
39- - uses : actions/github-script@v3
40- id : release-version
41- with :
42- github-token : ${{secrets.GITHUB_TOKEN}}
43- result-encoding : string
44- script : |
45- const version = core.getInput("version");
46- console.log("version=" + version)
47- if (version) {
48- return version
49- }
50- const list = await github.repos.listReleases({
51- owner: "domaframework",
52- repo: "sandbox",
53- });
54- console.log(list)
55- return list.data[0].name
56-
57- - name : Pre Release ${{ steps.release-version.outputs.result }}
61+ - name : Pre Release ${{ env.RELEASE_VERSION }}
5862 run : |
5963 java -version
6064 git config --global user.name "github-actions[bot]"
6165 git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
62- ./gradlew release -Prelease.releaseVersion=${{ steps.release-version.outputs.result }}
66+ ./gradlew release -Prelease.releaseVersion=${{ env.RELEASE_VERSION }}
6367
6468 - name : Upload reports
6569 if : failure()
0 commit comments