1- # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2- # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3-
4- # This workflow uses actions that are not certified by GitHub.
5- # They are provided by a third-party and are governed by
6- # separate terms of service, privacy policy, and support
7- # documentation.
8-
9- name : Java CI with Maven
1+ name : Java CI/CD with Maven
102
113on :
124 push :
135 branches : [ "main" ]
6+ tags :
7+ - ' v*'
148 pull_request :
159 branches : [ "main" ]
1610
11+ permissions :
12+ contents : write
13+ packages : write
14+
1715jobs :
1816 build :
19-
2017 runs-on : ubuntu-latest
2118
2219 steps :
2320 - uses : actions/checkout@v4
21+
2422 - name : Set up JDK 17
2523 uses : actions/setup-java@v4
2624 with :
2725 java-version : ' 17'
2826 distribution : ' temurin'
2927 cache : maven
28+
3029 - name : Build with Maven
3130 run : mvn -B package --file pom.xml
31+
32+ - name : Upload JAR artifact
33+ uses : actions/upload-artifact@v3
34+ with :
35+ name : chinese-identity-ocr
36+ path : target/*.jar
37+
38+ release :
39+ needs : build
40+ runs-on : ubuntu-latest
41+ if : startsWith(github.ref, 'refs/tags/')
42+
43+ steps :
44+ - name : Download JAR artifact
45+ uses : actions/download-artifact@v3
46+ with :
47+ name : chinese-identity-ocr
48+
49+ - name : Create Release
50+ uses : softprops/action-gh-release@v1
51+ with :
52+ files : |
53+ *.jar
54+ name : Release ${{ github.ref_name }}
55+ draft : false
56+ prerelease : false
57+ env :
58+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3259
33- # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
3460 - name : Update dependency graph
35- uses : advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
61+ uses : advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
0 commit comments