Skip to content

Commit

Permalink
feat: checks if weasyprint service should be upgraded
Browse files Browse the repository at this point in the history
Refs: #258
  • Loading branch information
grigoriev committed Oct 22, 2024
1 parent 1b8468d commit a890544
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
31 changes: 20 additions & 11 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: maven-build
on:
push:
branches: ['**/**']
pull_request:
branches: [main]
types: [opened, synchronize, reopened, ready_for_review]
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -13,14 +16,15 @@ jobs:
COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_TOKEN: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_TOKEN }}
COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE }}
GITHUB_TOKEN: ${{ github.token }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
MARKDOWN2HTML_MAVEN_PLUGIN_FAIL_ON_ERROR: true
steps:
- name: 📄 Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
fetch-depth: 0
- name: 🧱 Set up JDK and Maven
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4
with:
distribution: adopt
java-version: 17
Expand All @@ -33,7 +37,7 @@ jobs:
run: echo "cache_key=${{ runner.os }}-mvn-${{ hashFiles('**/pom.xml') }}-${{ github.sha }}" >> $GITHUB_OUTPUT
- name: 💾 Prepare Cache
id: prepare-cache
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
with:
path: |
/home/runner/.m2
Expand Down Expand Up @@ -88,8 +92,13 @@ jobs:
]
- name: 🔘 Print settings.xml
run: cat /home/runner/.m2/settings.xml
- name: 📦 Build with Maven
run: mvn --batch-mode clean package -P tests-with-weasyprint-docker
- name: 📦 Build with Maven for Pushes
if: github.event_name == 'push'
run: mvn --batch-mode clean package -P tests-with-weasyprint-docker sonar:sonar -Dsonar.branch.name=${{ github.head_ref }}
- name: 📦 Build with Maven for PRs
if: github.event_name == 'pull_request'
run: mvn --batch-mode clean package -P tests-with-weasyprint-docker sonar:sonar -Dsonar.pullrequest.base=${{ github.base_ref }} -Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
outputs:
project_version: ${{ steps.project_version.outputs.project_version }}
cache_key: ${{ steps.cache_key.outputs.cache_key }}
Expand All @@ -107,21 +116,21 @@ jobs:
COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE }}
steps:
- name: 🧱 Set up JDK and Maven
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4
with:
distribution: adopt
java-version: 17
gpg-private-key: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PRIVATE_KEY }}
- name: 💾 Restore Cache
id: restore-cache
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
with:
path: |
/home/runner/.m2
/home/runner/work
key: ${{ needs.build.outputs.cache_key }}
- name: 📦 Publish to Maven Central
run: mvn --batch-mode -Dmaven.test.skip=true deploy -P gpg-sign -P nexus-staging
run: mvn --batch-mode deploy -P gpg-sign -P nexus-staging

# Deploy release to GitHub Packages
deploy-github-packages:
Expand All @@ -137,20 +146,20 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
steps:
- name: 🧱 Set up JDK and Maven
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4
with:
distribution: adopt
java-version: 17
- name: 💾 Restore Cache
id: restore-cache
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
with:
path: |
/home/runner/.m2
/home/runner/work
key: ${{ needs.build.outputs.cache_key }}
- name: 📦 Publish to GitHub Packages
run: mvn --batch-mode -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dmaven.source.skip=true deploy -P deploy-github-packages
run: mvn --batch-mode -Dmaven.javadoc.skip=true -Dmaven.source.skip=true deploy -P deploy-github-packages
- name: 📦 Upload assets
run: |-
gh release upload v${{ needs.build.outputs.project_version }} target/*-${{ needs.build.outputs.project_version }}.jar
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: trailing-whitespace
- id: check-xml
Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand Down

0 comments on commit a890544

Please sign in to comment.