-
Notifications
You must be signed in to change notification settings - Fork 60
55 lines (53 loc) · 1.69 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
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Build
uses: burrunan/gradle-cache-action@v1
with:
job-id: jdk17
arguments: --scan --no-parallel --no-daemon -Prelease build
- name: Prepare GitHub Release
id: prepare_release
uses: release-drafter/release-drafter@v5
with:
tag: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Attach files to release
uses: actions/github-script@v6
env:
TAG: ${{ github.ref_name }}
# https://github.com/release-drafter/release-drafter#action-outputs
RELEASE_ID: ${{ steps.prepare_release.outputs.id }}
with:
# language=JavaScript
script: |
const fs = require('fs');
const {TAG, RELEASE_ID} = process.env;
const version = TAG.substring(1); // remove leading v
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
name: "ksar-" + version + ".jar",
release_id: RELEASE_ID,
data: fs.readFileSync("build/libs/ksar-" + version + "-all.jar")
})
- name: Publish GitHub Release
id: publish_release
uses: release-drafter/release-drafter@v5
with:
publish: true
tag: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}