Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Commit df1b7bc

Browse files
committed
ci: add release publish
1 parent 1ac2e58 commit df1b7bc

File tree

1 file changed

+59
-26
lines changed

1 file changed

+59
-26
lines changed

.github/workflows/gradle.yml

Lines changed: 59 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,70 @@
1-
# This workflow uses actions that are not certified by GitHub.
2-
# They are provided by a third-party and are governed by
3-
# separate terms of service, privacy policy, and support
4-
# documentation.
5-
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6-
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
7-
81
name: Java CI with Gradle
9-
2+
env:
3+
JAR_SHA256: ''
104
on:
115
push:
6+
paths:
7+
- ".github/workflows/*.yml"
8+
- "**.kts"
9+
- "**.kt"
10+
- "**.java"
1211
pull_request:
13-
14-
permissions:
15-
contents: read
12+
release:
13+
types:
14+
- created
15+
workflow_dispatch:
1616

1717
jobs:
1818
build:
19-
2019
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
- name: Set up JDK 17
23+
uses: actions/setup-java@v3
24+
with:
25+
java-version: '17'
26+
distribution: 'temurin'
2127

28+
- name: Build with Gradle
29+
uses: gradle/[email protected]
30+
with:
31+
arguments: build
32+
- name: Upload a Build Artifact
33+
uses: actions/[email protected]
34+
with:
35+
path: build/libs
36+
37+
upload-to-release:
38+
name: Upload to Release
39+
needs:
40+
- build
41+
runs-on: ubuntu-latest
42+
if: github.event_name == 'release'
2243
steps:
23-
- uses: actions/checkout@v3
24-
- name: Set up JDK 17
25-
uses: actions/setup-java@v3
26-
with:
27-
java-version: '17'
28-
distribution: 'temurin'
44+
- name: Checkout
45+
uses: actions/checkout@v3
46+
with:
47+
fetch-depth: 0
48+
49+
- name: Get Version
50+
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
51+
52+
- name: Download Artifacts
53+
uses: actions/download-artifact@v3
54+
55+
- name: Compute Artifacts SHA256
56+
run: |
57+
echo "JAR_SHA256=$(sha256sum artifact/HeaderGenerator-${{ env.VERSION }}-all.jar | cut -d ' ' -f 1)" >> $GITHUB_ENV
58+
shell: bash
2959

30-
- name: Build with Gradle
31-
uses: gradle/[email protected]
32-
with:
33-
arguments: build
34-
- name: Upload a Build Artifact
35-
uses: actions/[email protected]
36-
with:
37-
path: build/libs
60+
- name: Upload Release Assets
61+
uses: softprops/action-gh-release@v1
62+
with:
63+
append_body: true
64+
files: |
65+
artifact/HeaderGenerator-${{ env.VERSION }}-all.jar
66+
body: |
67+
---
68+
| File | SHA256 |
69+
| :--------------------------------------------- | :-------------------- |
70+
| HeaderGenerator-${{ env.VERSION }}-all.jar | ${{ env.JAR_SHA256 }} |

0 commit comments

Comments
 (0)