Skip to content

build(deps): bump hmarr/auto-approve-action from 3 to 4 #310

build(deps): bump hmarr/auto-approve-action from 3 to 4

build(deps): bump hmarr/auto-approve-action from 3 to 4 #310

Workflow file for this run

name: Maven Central SNAPSHOT deployment
on:
pull_request:
types: [ opened, synchronize, reopened ]
env:
SONAR_PROJECT_KEY: vincejv_fpi-framework
jobs:
pre_job:
name: Duplicate checks
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
paths_result: ${{ steps.skip_check.outputs.paths_result }}
steps:
- name: Skip duplicate actions
id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: outdated_runs
cancel_others: true
code_quality_checks:
name: Code quality checks
runs-on: ubuntu-latest
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: maven
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }} -Dsonar.qualitygate.wait=true
deploy:
name: Release artifact
runs-on: ubuntu-latest
needs: code_quality_checks
outputs:
artifact_version: ${{ steps.gen_ver.outputs.artifact_version }}
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Build and release to central repo
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
run: mvn -B deploy -Prelease-for-oss
- name: Store artifact version
id: gen_ver
run: |
echo "artifact_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
pr_update:
name: Pull request update
if: always()
needs: [pre_job, deploy]
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write # allows job to decorate PRs with analysis results
steps:
- name: Update PR (Skip message)
uses: marocchino/sticky-pull-request-comment@v2
if: ${{ always() && needs.pre_job.outputs.should_skip == 'true' }}
with:
message: |
⚪ Skipped CI/CD as deployment was done in a previous job
- name: Update PR (Success message)
uses: marocchino/sticky-pull-request-comment@v2
if: ${{ always() && needs.pre_job.outputs.should_skip != 'true' && needs.deploy.outputs.artifact_version != '' }}
with:
message: |
✅ Released version to SNAPSHOT repository: `${{ needs.deploy.outputs.artifact_version }}`
#### Parent POM Usage:
```xml
<parent>
<groupId>com.abavilla</groupId>
<artifactId>fpi-framework-pom</artifactId>
<version>${{ needs.deploy.outputs.artifact_version }}</version>
</parent>
```
#### BOM Usage:
```xml
<dependencyManagement>
<dependency>
<groupId>com.abavilla</groupId>
<artifactId>fpi-framework-bom</artifactId>
<version>${{ needs.deploy.outputs.artifact_version }}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencyManagement>
```
- name: Update PR (Failure message)
uses: marocchino/sticky-pull-request-comment@v2
if: ${{ always() && needs.pre_job.outputs.should_skip != 'true' && needs.deploy.outputs.artifact_version == '' }}
with:
message: |
❌ CI Build & Deployment failed, please check the [logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details