Skip to content
This repository was archived by the owner on Apr 24, 2023. It is now read-only.

Commit c9a34e8

Browse files
authored
Merge pull request #2 from Crec0/chore/workflows
chore: add workflows
2 parents 29b9456 + ad46948 commit c9a34e8

File tree

3 files changed

+131
-0
lines changed

3 files changed

+131
-0
lines changed

.github/workflows/pr-artifact.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
name: Build And Upload Artifact
3+
4+
on: [ pull_request ]
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
12+
- name: Set up JDK 16
13+
uses: actions/setup-java@v2
14+
with:
15+
distribution: 'temurin'
16+
java-version: 16
17+
18+
- name: Cache Gradle packages
19+
uses: actions/cache@v2
20+
with:
21+
path: ~/.gradle/caches
22+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
23+
restore-keys: ${{ runner.os }}-gradle
24+
25+
- name: Grant execute permission to gradlew
26+
run: chmod +x gradlew
27+
28+
- name: Build with Gradle
29+
run: ./gradlew build
30+
31+
- name: Delete -dev and -sources
32+
run: rm -rf build/libs/*-sources.jar build/libs/*-dev.jar
33+
34+
- name: Upload artifact
35+
uses: actions/upload-artifact@v2
36+
with:
37+
name: Compiled artifacts for ${{ github.sha }}
38+
path: build/libs
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Publish release
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Set up JDK 16
14+
uses: actions/setup-java@v2
15+
with:
16+
distribution: 'temurin'
17+
java-version: 16
18+
19+
- name: Cache Gradle packages
20+
uses: actions/cache@v2
21+
with:
22+
path: ~/.gradle/caches
23+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
24+
restore-keys: ${{ runner.os }}-gradle
25+
26+
- name: Grant execute permission to gradlew
27+
run: chmod +x gradlew
28+
29+
- name: Build with Gradle
30+
run: ./gradlew build
31+
32+
- name: Delete -dev and -sources
33+
run: rm -rf build/libs/*-sources.jar build/libs/*-dev.jar
34+
35+
- name: Find jar name
36+
id: findJar
37+
run: |
38+
output="$(find build/libs/ -type f -printf "%f\n")"
39+
echo "::set-output name=jarname::$output"
40+
41+
- name: Upload artifact
42+
uses: actions/upload-artifact@v2
43+
with:
44+
name: Compiled artifacts for ${{ github.sha }}
45+
path: build/libs
46+
47+
- name: Publish release
48+
uses: actions/upload-release-asset@v1
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
with:
52+
upload_url: ${{ github.event.release.upload_url }}
53+
asset_path: build/libs/${{ steps.findJar.outputs.jarname }}
54+
asset_name: ${{ steps.findJar.outputs.jarname }}
55+
asset_content_type: application/java-archive
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
name: Build And Upload Artifact
3+
4+
on: [ push ]
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
12+
- name: Set up JDK 16
13+
uses: actions/setup-java@v2
14+
with:
15+
distribution: 'temurin'
16+
java-version: 16
17+
18+
- name: Cache Gradle packages
19+
uses: actions/cache@v2
20+
with:
21+
path: ~/.gradle/caches
22+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
23+
restore-keys: ${{ runner.os }}-gradle
24+
25+
- name: Grant execute permission to gradlew
26+
run: chmod +x gradlew
27+
28+
- name: Build with Gradle
29+
run: ./gradlew build
30+
31+
- name: Delete -dev and -sources
32+
run: rm -rf build/libs/*-sources.jar build/libs/*-dev.jar
33+
34+
- name: Upload artifact
35+
uses: actions/upload-artifact@v2
36+
with:
37+
name: Compiled artifacts for ${{ github.sha }}
38+
path: build/libs

0 commit comments

Comments
 (0)