Skip to content

Commit fe6c493

Browse files
committed
Fix CI to avoid failing deploy attempts for non-snapshot
1 parent 7df531b commit fe6c493

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

.github/workflows/main.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,44 @@ on:
44
branches:
55
- master
66
- "3.0"
7+
- "2.14"
78
- "2.13"
89
paths-ignore:
910
- "README.md"
11+
- "release-notes/*"
1012
jobs:
1113
build:
1214
runs-on: ${{ matrix.os }}
1315
strategy:
1416
fail-fast: false
1517
matrix:
16-
java_version: ['8', '14']
18+
java_version: ['8', '11', '17']
1719
os: ['ubuntu-20.04']
1820
env:
1921
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
2022
steps:
21-
- uses: actions/checkout@v2
23+
- uses: actions/checkout@v3
2224
- name: Set up JDK
23-
uses: actions/setup-java@v2
25+
uses: actions/setup-java@v3
2426
with:
25-
distribution: "adopt"
27+
distribution: 'temurin'
2628
java-version: ${{ matrix.java_version }}
29+
cache: 'maven'
2730
server-id: sonatype-nexus-snapshots
2831
server-username: CI_DEPLOY_USERNAME
2932
server-password: CI_DEPLOY_PASSWORD
30-
- uses: actions/[email protected]
31-
with:
32-
path: ~/.m2/repository
33-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
34-
restore-keys: |
35-
${{ runner.os }}-maven-
33+
# See https://github.com/actions/setup-java/blob/v2/docs/advanced-usage.md#Publishing-using-Apache-Maven
34+
# gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
35+
# gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
3636
- name: Build
37-
run: ./mvnw -V -B -ff -ntp verify
37+
run: ./mvnw -B -q -ff -ntp verify
38+
- name: Extract project Maven version
39+
id: projectVersion
40+
run: echo ::set-output name=version::$(./mvnw org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -DforceStdout -Dexpression=project.version -q)
3841
- name: Deploy snapshot
39-
if: github.event_name != 'pull_request' && matrix.java_version == '8'
42+
if: github.event_name != 'pull_request' && matrix.java_version == '8' && endsWith(steps.projectVersion.outputs.version, '-SNAPSHOT')
4043
env:
4144
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
4245
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
4346
# MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
44-
run: ./mvnw -V -B -ff -DskipTests -ntp source:jar deploy
47+
run: ./mvnw -B -q -ff -DskipTests -ntp source:jar deploy

0 commit comments

Comments
 (0)