#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
Add sync-versions job to GitHub Actions workflow (#5228)
Ludya95583b9e081
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex bacbd120ed..52e40db51d 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -196,6 +196,104 @@ jobs:path: frontend/dist/retention-days: 3+ sync-versions:+ if: needs.files-changed.outputs.build == 'true'+ needs: [files-changed, build]+ runs-on: ubuntu-latest+ steps:+ - name: Harden Runner+ uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1+ with:+ egress-policy: audit++ - name: Checkout repository+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0+ with:+ fetch-depth: 0++ - name: Setup GitHub App Bot+ id: setup-bot+ uses: ./.github/actions/setup-bot+ with:+ app-id: ${{ secrets.GH_APP_ID }}+ private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}++ - name: Set up JDK 21+ uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0+ with:+ java-version: "21"+ distribution: "temurin"++ - name: Setup Gradle+ uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0+ with:+ gradle-version: 8.14++ - name: Run version sync+ run: ./gradlew syncAppVersion --build-cache++ - name: Check if version files have changed+ id: git-check+ run: |+ if [[ -n $(git status --porcelain) ]]; then+ echo "changes=true" >> $GITHUB_OUTPUT+ else+ echo "changes=false" >> $GITHUB_OUTPUT+ fi++ - name: Post comment on PR+ if: steps.git-check.outputs.changes == 'true' && github.event_name != 'workflow_dispatch'+ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1+ with:+ github-token: ${{ steps.setup-bot.outputs.token }}+ script: |+ const { GITHUB_REPOSITORY } = process.env;+ const [repoOwner, repoName] = GITHUB_REPOSITORY.split('/');+ const issueNumber = context.issue.number;++ // Find existing comment+ const comments = await github.rest.issues.listComments({+ owner: repoOwner,+ repo: repoName,+ issue_number: issueNumber+ });++ const comment = comments.data.find(c => c.body.includes("## ⚠️ Version Differences"));++ const commentBody = `## ⚠️ Version Differences++ The versions in the following files do not match the version defined in \`build.gradle\`.++ Running \`./gradlew syncAppVersion\` or \`./gradlew build\` will automatically update these files:++ \`frontend/src-tauri/tauri.conf.json\`, \`frontend/src/proprietary/testing/serverExperienceSimulations.ts\`, \`frontend/src/core/testing/serverExperienceSimulations.ts\`++ Please run \`./gradlew syncAppVersion\` or \`./gradlew build\`!`;++ // Only update or create comments by the action user+ const expectedActor = "${{ steps.setup-bot.outputs.app-slug }}[bot]";++ if (comment && comment.user.login === expectedActor) {+ // Update existing comment+ await github.rest.issues.updateComment({+ owner: repoOwner,+ repo: repoName,+ comment_id: comment.id,+ body: commentBody+ });+ console.log("Updated existing comment.");+ } else if (!comment) {+ // Create new comment if no existing comment is found+ await github.rest.issues.createComment({+ owner: repoOwner,+ repo: repoName,+ issue_number: issueNumber,+ body: commentBody+ });+ } else {+ console.log("Comment update attempt denied. Actor does not match.");+ }+check-licence:if: needs.files-changed.outputs.build == 'true'needs: [files-changed, build]diff --git a/build.gradle b/build.gradleindex 75a9e26328..2a5384e249 100644--- a/build.gradle+++ b/build.gradle@@ -533,4 +533,4 @@ tasks.register('buildRestartHelper', Jar) {doLast {println "restart-helper.jar created at: ${destinationDirectory.get()}/restart-helper.jar"}-}+}\ No newline at end of file