You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# in order to write status info to the PR we require write repository token (https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/)
10
+
pull_request:
11
+
branches:
12
+
- main
13
+
types: [opened, synchronize, reopened]
14
+
15
+
# restrict privileges except for setting commit status, adding PR comments and writing statuses
16
+
permissions:
17
+
actions: read
18
+
checks: write
19
+
contents: read
20
+
deployments: read
21
+
issues: read
22
+
packages: read
23
+
pull-requests: write
24
+
repository-projects: read
25
+
security-events: read
26
+
statuses: write
27
+
28
+
jobs:
29
+
build:
30
+
strategy:
31
+
matrix:
32
+
os: [ubuntu-latest, macos-latest, windows-latest]
33
+
jdk: [21, 25]
34
+
include:
35
+
# lengthy build steps should only be performed on linux with Java 17 (Sonarcloud analysis, deployment)
# always act on the modified source code (even for event pull_request_target)
49
+
# is considered potentially unsafe (https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) but actions are only executed after approval from committers
50
+
with:
51
+
ref: ${{ github.event.pull_request.head.sha }}
52
+
# no additional git operations after checkout triggered in workflow, no need to store credentials
53
+
persist-credentials: false
54
+
55
+
- name: Set up JDK
56
+
uses: actions/setup-java@v4
57
+
with:
58
+
cache: 'maven'
59
+
distribution: 'temurin'
60
+
java-version: ${{ matrix.jdk }}
61
+
# generate settings.xml with the correct values
62
+
server-id: sonatype-central-portal # Value of the distributionManagement/repository/id field of the pom.xml
63
+
server-username: MAVEN_USERNAME # env variable for username in deploy
64
+
server-password: MAVEN_PASSWORD # env variable for token in deploy
65
+
66
+
# sets environment variables to be used in subsequent steps: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
67
+
- name: Set environment variables
68
+
shell: bash
69
+
run: |
70
+
if [ "${{ matrix.isMainBuildEnv }}" = "true" ]; then
0 commit comments