Merge pull request #371 from camunda-community-hub/dependabot/maven/c… #1258
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If this workflow is triggered by a push to $default_branch, it | |
# deploys a SNAPSHOT | |
# If this workflow is triggered by publishing a Release, it | |
# deploys a RELEASE with the selected version | |
# updates the project version by incrementing the patch version | |
# commits the version update change to the repository's default branch ($default_branch). | |
name: Build, test and deploy artifacts with Maven | |
on: | |
pull_request: { } | |
push: { } | |
workflow_dispatch: { } | |
release: | |
types: [ published ] | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Set up Java environment | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
gpg-private-key: ${{ secrets.MAVEN_CENTRAL_GPG_SIGNING_KEY_SEC }} | |
gpg-passphrase: MAVEN_CENTRAL_GPG_PASSPHRASE | |
- name: Build | |
id: build | |
run: mvn -B -U -Dsurefire.rerunFailingTestsCount=5 clean install | |
- name: Archive Test Results on Failure | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: test-results | |
path: target/surefire-reports/ | |
retention-days: 7 | |
- name: Publish Unit Test Results | |
id: publish | |
uses: EnricoMi/publish-unit-test-result-action@v1 | |
if: failure() | |
with: | |
files: target/surefire-reports/*.xml | |
- if: github.event.release || github.event_name == 'workflow_dispatch' | |
name: Deploy SNAPSHOT / Release | |
uses: camunda-community-hub/community-action-maven-release@v1 | |
with: | |
release-version: ${{ github.event.release.tag_name }} | |
release-profile: community-action-maven-release | |
nexus-usr: ${{ secrets.NEXUS_USR }} | |
nexus-psw: ${{ secrets.NEXUS_PSW }} | |
maven-usr: ${{ secrets.MAVEN_CENTRAL_DEPLOYMENT_USR }} | |
maven-psw: ${{ secrets.MAVEN_CENTRAL_DEPLOYMENT_PSW }} | |
maven-gpg-passphrase: ${{ secrets.MAVEN_CENTRAL_GPG_SIGNING_KEY_PASSPHRASE }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
id: release | |
- if: github.event.release | |
name: Attach artifacts to GitHub Release (Release only) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ${{ steps.release.outputs.artifacts_archive_path }} | |
asset_name: ${{ steps.release.outputs.artifacts_archive_path }} | |
asset_content_type: application/zip | |
- if: github.event.release | |
name: Build & Push Docker images | |
id: docker | |
timeout-minutes: 10 | |
run: | | |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin | |
mvn -B -Pdocker -DskipTests -DdockerGoal=build -DdockerImageTag=${{ github.event.release.tag_name }} package | |
auto-merge: | |
name: Auto-merge dependabot PRs | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
if: github.repository == 'camunda-community-hub/eze' && github.actor == 'dependabot[bot]' | |
permissions: | |
checks: read | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- id: metadata | |
name: Fetch dependency metadata | |
uses: dependabot/[email protected] | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
- id: merge | |
name: Merge PR | |
run: gh pr merge ${{ github.event.pull_request.number }} --merge | |
env: | |
GITHUB_TOKEN: "${{secrets.AUTO_MERGE_GITHUB_TOKEN}}" |