-
Notifications
You must be signed in to change notification settings - Fork 9
84 lines (75 loc) · 2.64 KB
/
main.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
name: Build
on:
push:
tags:
- 'v*'
env:
PROJECT_ID: "362368"
permissions:
contents: write
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Get Version
id: version
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
let ref = '${{ github.ref }}';
return ref.startsWith('refs/tags/v') ? ref.replace('refs/tags/v', '') : 'indev';
- name: Get Version Type
id: version_type
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
let version = '${{ steps.version.outputs.result }}';
return version.includes('alpha') ? 'alpha' : (version.includes('beta') ? 'beta' : (version == 'indev' ? 'indev' : 'release'));
- name: Log Version Info
env:
VERSION: ${{ steps.version.outputs.result }}
VERSION_TYPE: ${{ steps.version_type.outputs.result }}
run: echo "version = $VERSION, type = $VERSION_TYPE"
- name: Build
uses: gradle/gradle-build-action@v2
with:
arguments: build
env:
VERSION: ${{ steps.version.outputs.result }}
- name: Create Release
id: create_release
if: ${{ steps.version.outputs.result != 'indev' && success() }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version.outputs.result }}
release_name: DynamicTrees TFC v${{ steps.version.outputs.result }}
body: |
Version ${{ steps.version.outputs.result }}
### Changes
- todo: document changes
draft: true
prerelease: ${{ steps.version_type.outputs.result != 'release' }}
- name: Upload Main Jar
id: upload_main_jar
if: ${{ steps.version.outputs.result != 'indev' && success() }}
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/libs/dttfc-1.18.2-${{ steps.version.outputs.result }}.jar
asset_name: dttfc-${{ steps.version.outputs.result }}.jar
asset_content_type: application/java-archive