1+ # java example
2+
3+ name : Publish to Maven
4+
5+ on :
6+ release :
7+ types : [created]
8+
9+ jobs :
10+ check-docs-update :
11+ runs-on : ubuntu-latest
12+ env :
13+ OS : ubuntu-latest
14+ steps :
15+ - uses : actions/checkout@v3
16+ - name : Set up JDK 17
17+ uses : actions/setup-java@v3
18+ with :
19+ java-version : ' 17'
20+ distribution : ' temurin'
21+
22+ - uses : technote-space/get-diff-action@v6
23+ with :
24+ PATTERNS : |
25+ +(documentation)/*.md
26+ *.md
27+ CHANGE*.md
28+ FILES : |
29+ CHANGELOG.md
30+
31+ - name : log git diff
32+ run : |
33+ echo ${{ env.GIT_DIFF }}
34+ echo ${{ env.MATCHED_FILES }}
35+ echo ${{ env.GIT_DIFF_FILTERED }}
36+
37+ - name : Check if README.md or Doc/** is updated else exit
38+ if : (env.GIT_DIFF == '')
39+ run : |
40+ echo Update documentation files and README.md before push
41+ exit 1
42+
43+ - name : push build status to Slack
44+ uses : 8398a7/action-slack@v3
45+ with :
46+ status : ${{ job.status }}
47+ fields : repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest
48+ env :
49+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
50+ if : always()
51+
52+
53+ distribute :
54+ runs-on : ubuntu-latest
55+ env :
56+ OS : ubuntu-latest
57+ steps :
58+ - uses : actions/checkout@v3
59+ - name : Set up JDK 17
60+ uses : actions/setup-java@v3
61+ with :
62+ java-version : ' 17'
63+ distribution : ' temurin'
64+
65+ - name : Build with Maven
66+ run : mvn --batch-mode --update-snapshots package
67+
68+
69+ - name : Deploy to Maven Central
70+ uses : maven-publish/setup-maven@v1
71+ with :
72+ maven-version : ' 3.8.3'
73+ maven-settings : ${{ secrets.MAVEN_SETTINGS }}
74+ java-version : ' 17'
75+
76+ - name : Publish to Maven Central
77+ uses : maven-publish/action@v1
78+ with :
79+ pom : pom.xml
80+ server-id : maven.central
81+ server-username : ${{ secrets.MAVEN_USERNAME }}
82+ server-password : ${{ secrets.MAVEN_PASSWORD }}
83+ skip-cleanup : true
84+
85+ - name : push build status to Slack
86+ uses : 8398a7/action-slack@v3
87+ with :
88+ status : ${{ job.status }}
89+ fields : repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest
90+ env :
91+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
92+ if : always()
0 commit comments