Skip to content

Commit a95ac24

Browse files
Create build-and-publish.yml
1 parent 54ae401 commit a95ac24

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
3+
4+
name: Build and Publish
5+
6+
on:
7+
push:
8+
branches: [ dev , master ]
9+
paths-ignore:
10+
- .gradle/wrapper
11+
- .gitignore
12+
- CONTRIBUTING.md
13+
- LICENSE
14+
- THIRD PARTY NOTICES
15+
- gradle.properties
16+
- gradlew
17+
- gradlew.bat
18+
- readme.md
19+
- settings.gradle
20+
- Scripts/*
21+
22+
jobs:
23+
build-and-publish:
24+
env:
25+
GRADLE_OPTIONS: -x jar -x javadoc -x javadocJar -x compileJava -x processResources -x classes -x sourceJar
26+
PREVIEW_TASK: publishSnapshotPublicationToSonatypeSnapshotRepository
27+
PUBLISH_TASK: publishMavenCentralReleasePublicationToSonatypeRepository
28+
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- uses: actions/checkout@v2
33+
34+
35+
36+
- name: Set up JDK 11
37+
uses: actions/setup-java@v2
38+
with:
39+
java-version: '16'
40+
distribution: 'adopt'
41+
cache: gradle
42+
43+
- name: Grant execute permission for gradlew
44+
run: chmod +x gradlew
45+
- name: Preview
46+
if: ${{ github.ref == 'refs/head/dev' }}
47+
run: ./gradlew $GRADLE_OPTIONS $PREVIEW_TASK
48+
- name: Publish
49+
if: ${{ github.ref === 'refs/head/master' }}
50+
run: ./gradlew $GRADLE_OPTIONS $PUBLISH_TASK

0 commit comments

Comments
 (0)