-
Notifications
You must be signed in to change notification settings - Fork 4
70 lines (60 loc) · 2.03 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
name: Release on tag
on:
push:
tags:
- '**'
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Set output variables
id: export_vars
run: |
export RELEASE_UPLOAD_URL="${{ steps.create_release.outputs.upload_url }}"
echo "::set-output name=release_upload_url::${RELEASE_UPLOAD_URL}"
outputs:
release_upload_url: ${{ steps.export_vars.outputs.release_upload_url }}
build-java-11:
needs: create-release
runs-on: ubuntu-latest
steps:
#Checkout
- uses: actions/checkout@v2
#Setup Java 16
- name: Set up Java 16
uses: actions/setup-java@v1
with:
java-version: 1.16
#Apply permissions for Gradle, so that ./gradlew can run
- name: Grant execute permission for gradlew
run: chmod +x gradlew
#Build the JAR
- name: Build with Gradle
run: ./gradlew ghActions
#Extract version number
- name: Extract version number
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
#Extract repository name
- name: Extract repository name
run: echo "REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")" >> $GITHUB_ENV
#Attach compiled JAR to ReleaseS
- name: Attach JAR to Release
id: upload_release_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.release_upload_url }}
asset_path: actions/output.jar
asset_name: ${{ env.REPOSITORY_NAME }}-${{ env.RELEASE_VERSION }}-RELEASE.jar
asset_content_type: application/java-archive