| commit | 83f951a2f09c725926f881b5c7f77d23d7b02296 | [log] [tgz] | 
|---|---|---|
| author | Slawomir Jaranowski <s.jaranowski@gmail.com> | Tue Jan 28 19:26:01 2025 +0100 | 
| committer | Slawomir Jaranowski <s.jaranowski@gmail.com> | Wed Jan 29 11:58:19 2025 +0100 | 
| tree | 819936ee3da95019ebc8f84f85c6358388ec47b9 | |
| parent | ca9978523bd69a9a1808fb269dff199d8c1ffe39 [diff] | 
By default, filter releases by branches
Create GitHub workflow in project file:
.github/workflows/maven-verify.yml
with content:
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. name: Verify on: push: pull_request: jobs: build: name: Verify uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4
In such configuration workflow can be executed in the same time twice for two separate events.
It can occurs when we create PR for branch from the same repository, we have two events:
push on branchpull_request on PR for the same branchIn order to minimize resource consumptions shared workflow from version v2 detect such situation and skips the execution for pull_request event if PR is created for local branch.
Only workflow for PR from external forks will be executed.
maven_version by maven-matrix and ff-mavenmaven_args to maven-argsverify-site-goalWe can store some logs of execution in case of failure as workflow attachments:
... uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4 with: failure-upload-path: | **/target/surefire-reports/*
... uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4 with: matrix-exclude: > [ {"jdk": "8"}, # exclude jdk 8 from all builds {"os": "windows-latest"}, # exclude windows from all builds {"jdk": "8", "os": "windows-latest"} # exclude jkd 8 on windows ]
... uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4 with: ff-goal: 'install' verify-goal: 'install -P run-its'
... uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4 with: ff-maven: "3.8.6" # Maven version for fail-fast-build maven-matrix: '[ "3.2.5", "3.8.6" ]' # Maven versions matrix for verify builds
... uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4 with: maven4-enabled: true maven4-version: 'xxx' # only needed if you want to override default verify-goal: 'verify' # only needed if project doesn't have a run-its profile
... uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4 with: matrix-enabled: false
More options with default values can be found in workflow source in inputs section:
https://github.com/apache/maven-gh-actions-shared/blob/v4/.github/workflows/maven-verify.yml
Create GitHub workflow in project file:
.github/workflows/pr-automation.yml
with content:
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. name: PR Automation on: pull_request_target: types: - closed - unlabeled - review_requested jobs: pr-automation: name: PR Automation uses: apache/maven-gh-actions-shared/.github/workflows/pr-automation.yml@v4
We need a use pull_request_target event because we need GITHUB_TOKEN with write permission to update labels, milestones of PR from forked repositories.
After approval or merged:
maintenance will be addedWe need exactly one open milestone in order to detect which is current.
If we need more than one open milestone, we have to add a branch to the milestone description
branch: <branch name>
This identifies the default for that branch.
We can synchronize labels for all Maven repositories by action: Labels sync
Labels list are in file: ./.github/labels.js
Action require GitHub token which will be used for performing updates. Please create new Personal access tokens (classic) with repo scope.