File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- name : Java CI with Maven
1+ name : Build java API
22
33on :
44 push :
55 branches : [ main ]
66 pull_request :
77 branches : [ main ]
88 workflow_dispatch :
9+ inputs :
10+ run_tests :
11+ description : ' Run tests'
12+ required : true
13+ default : true
14+ type : boolean
15+ run_deploy :
16+ description : ' Deploy to GitHub Packages'
17+ required : true
18+ default : false
19+ type : boolean
20+
921jobs :
1022 build :
1123 runs-on : ubuntu-latest
@@ -24,10 +36,11 @@ jobs:
2436 run : mvn -B clean package --file pom.xml
2537
2638 - name : Run Tests
39+ if : ${{ github.event_name == 'workflow_dispatch' && inputs.run_tests || github.event_name != 'workflow_dispatch' }}
2740 run : mvn -B test --file pom.xml
2841
2942 - name : Publish to GitHub Packages
30- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
43+ if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && inputs.run_deploy) }}
3144 run : mvn deploy -DskipTests
3245 env :
3346 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments