Skip to content

Commit 090a5d5

Browse files
committed
Add build, PR and publish workflows
1 parent 00c79ae commit 090a5d5

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

.github/workflows/build-master.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build master branch
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout latest code
13+
uses: actions/checkout@v2
14+
15+
- name: Setup JDK 8
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 8
19+
20+
- name: Setup build cache
21+
uses: actions/cache@v2
22+
with:
23+
path: ~/.gradle/caches
24+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
25+
restore-keys: ${{ runner.os }}-gradle-
26+
27+
- name: Build with Gradle
28+
run: ./gradlew build
29+
30+
- name: Upload artifact
31+
uses: actions/upload-artifact@v1
32+
with:
33+
name: Package
34+
path: build/libs
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish-release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout latest code
12+
uses: actions/checkout@v2
13+
14+
- name: Setup JDK 8
15+
uses: actions/setup-java@v1
16+
with:
17+
java-version: 8
18+
19+
- name: Setup build cache
20+
uses: actions/cache@v2
21+
with:
22+
path: ~/.gradle/caches
23+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
24+
restore-keys: ${{ runner.os }}-gradle-
25+
26+
- name: Publish artifact
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
# The GITHUB_REF tag comes in the format 'refs/tags/xxx'.
30+
# So if we split on '/' and take the 3rd value, we can get the release name.
31+
run: |
32+
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
33+
echo "New version: ${NEW_VERSION}"
34+
echo "Github username: ${GITHUB_ACTOR}"
35+
./gradlew -Pversion=${NEW_VERSION} publish

.github/workflows/pull-request.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build pull request
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout latest code
11+
uses: actions/checkout@v2
12+
13+
- name: Setup JDK 8
14+
uses: actions/setup-java@v1
15+
with:
16+
java-version: 8
17+
18+
- name: Setup build cache
19+
uses: actions/cache@v2
20+
with:
21+
path: ~/.gradle/caches
22+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
23+
restore-keys: ${{ runner.os }}-gradle-
24+
25+
- name: Build with Gradle
26+
run: ./gradlew build

0 commit comments

Comments
 (0)