From 7e8afde50e186add46076a242e3f1efc301c64db Mon Sep 17 00:00:00 2001 From: Swordsteel Date: Tue, 29 Jul 2025 23:29:23 +0200 Subject: [PATCH] update publish artifact --- .github/workflows/publish-artifact.yml | 12 +++++-- .github/workflows/publish-catalog.yml | 43 -------------------------- .github/workflows/release.yml | 10 +++--- 3 files changed, 15 insertions(+), 50 deletions(-) delete mode 100644 .github/workflows/publish-catalog.yml diff --git a/.github/workflows/publish-artifact.yml b/.github/workflows/publish-artifact.yml index bbcb894..d208fa3 100644 --- a/.github/workflows/publish-artifact.yml +++ b/.github/workflows/publish-artifact.yml @@ -16,6 +16,10 @@ on: description: Release version required: true type: string + GRADLE_TASK: + description: Gradle task to run (e.g., 'build publish' or 'publishPluginMavenPublicationToGitHubPackagesRepository') + required: true + type: string secrets: CI_BOT_PAT: required: true @@ -25,7 +29,7 @@ env: REPOSITORY_TOKEN: ${{ secrets.CI_BOT_PAT }} jobs: - publish-artifact: + publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -33,11 +37,13 @@ jobs: fetch-depth: 0 ref: "v${{ inputs.PROJECT_VERSION }}" token: ${{ secrets.CI_BOT_PAT }} + - name: Set up JDK uses: actions/setup-java@v4 with: distribution: temurin java-version: ${{ inputs.JAVA_VERSION }} cache: 'gradle' - - name: Build with Gradle - run: ./gradlew build publish + + - name: Run Gradle + run: ./gradlew ${{ inputs.GRADLE_TASK }} diff --git a/.github/workflows/publish-catalog.yml b/.github/workflows/publish-catalog.yml deleted file mode 100644 index db09084..0000000 --- a/.github/workflows/publish-catalog.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Publish Catalog - -on: - workflow_call: - inputs: - JAVA_VERSION: - description: Java version to use - required: false - type: string - default: '17' - PROJECT_NAME: - description: Project name - required: true - type: string - PROJECT_VERSION: - description: Release version - required: true - type: string - secrets: - CI_BOT_PAT: - required: true - -env: - REPOSITORY_USER: ${{ vars.CI_BOT_USERNAME }} - REPOSITORY_TOKEN: ${{ secrets.CI_BOT_PAT }} - -jobs: - publish-catalog: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: "v${{ inputs.PROJECT_VERSION }}" - token: ${{ secrets.CI_BOT_PAT }} - - name: Set up JDK - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: ${{ inputs.JAVA_VERSION }} - cache: 'gradle' - - name: Build with Gradle - run: ./gradlew publish diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6448c22..d85e952 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ on: type: string TYPE: default: '' - description: Type of release (service, artifact, or catalog) + description: Type of release (service, artifact, or plugin) required: false type: string @@ -151,17 +151,19 @@ jobs: secrets: CI_BOT_PAT: ${{ secrets.CI_BOT_PAT }} with: + GRADLE_TASK: publish JAVA_VERSION: ${{ inputs.JAVA_VERSION }} PROJECT_NAME: ${{ needs.release.outputs.project-name }} PROJECT_VERSION: ${{ needs.release.outputs.release-version }} - finalise-publish-catalog: + finalise-publish-plugin: needs: release - if: needs.release.outputs.has-changes == 'true' && inputs.TYPE == 'catalog' - uses: ./.github/workflows/publish-catalog.yml + if: needs.release.outputs.has-changes == 'true' && inputs.TYPE == 'plugin' + uses: ./.github/workflows/publish-artifact.yml secrets: CI_BOT_PAT: ${{ secrets.CI_BOT_PAT }} with: + GRADLE_TASK: publishAllPublicationsToGitHubPackagesRepository JAVA_VERSION: ${{ inputs.JAVA_VERSION }} PROJECT_NAME: ${{ needs.release.outputs.project-name }} PROJECT_VERSION: ${{ needs.release.outputs.release-version }}