Skip to content

Commit e66cac2

Browse files
authored
Merge pull request #82 from sebthom/gha
ci: improve GHA workflow config
2 parents 832cce4 + f5c6884 commit e66cac2

File tree

1 file changed

+40
-17
lines changed

1 file changed

+40
-17
lines changed

.github/workflows/maven.yml

+40-17
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,54 @@
11
# 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-
2+
# For more information see:
3+
# - https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-java-with-maven
4+
# - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
95
name: Java CI with Maven
106

117
on:
128
push:
13-
branches: [ "master" ]
9+
branches-ignore: # build all branches except:
10+
- 'dependabot/**' # prevent GHA triggered twice (once for commit to the branch and once for opening/syncing the PR)
11+
tags-ignore: # don't build tags
12+
- '**'
13+
paths-ignore:
14+
- 'Jenkinsfile'
15+
- 'LICENSE'
16+
- '**/*.md'
17+
- '.git*'
18+
- '.github/*.yml'
1419
pull_request:
15-
branches: [ "master" ]
20+
paths-ignore:
21+
- 'Jenkinsfile'
22+
- 'LICENSE'
23+
- '**/*.md'
24+
- '.git*'
25+
- '.github/*.yml'
26+
workflow_dispatch:
27+
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
28+
29+
30+
defaults:
31+
run:
32+
shell: bash
33+
1634

1735
jobs:
1836
build:
19-
2037
runs-on: ubuntu-latest
2138

39+
env:
40+
JAVA_VERSION: 11
41+
2242
steps:
23-
- uses: actions/checkout@v3
24-
- name: Set up JDK 11
25-
uses: actions/setup-java@v3
43+
- name: Git Checkout
44+
uses: actions/checkout@v4 # https://github.com/actions/checkout
45+
46+
- name: Set up JDK ${{ env.JAVA_VERSION }} ☕
47+
uses: actions/setup-java@v4 # https://github.com/actions/setup-java
2648
with:
27-
java-version: '11'
28-
distribution: 'temurin'
49+
java-version: ${{ env.JAVA_VERSION }}
50+
distribution: temurin
2951
cache: maven
30-
- name: Build with Maven
31-
run: mvn -B package --file pom.xml
52+
53+
- name: Build with Maven 🔨
54+
run: mvn -ntp -B verify

0 commit comments

Comments
 (0)