From 1839695eb34ea2de7a6931709f0d9c0d1b8e79a1 Mon Sep 17 00:00:00 2001 From: Janne Valkealahti Date: Thu, 18 Mar 2021 17:43:53 +0000 Subject: [PATCH] Central sync - Attempt to use actions to sync central. --- .github/release-files-spec.json | 28 +++++++++++ .github/workflows/central-sync-create.yml | 61 +++++++++++++++++++++++ .gitignore | 1 + 3 files changed, 90 insertions(+) create mode 100644 .github/release-files-spec.json create mode 100644 .github/workflows/central-sync-create.yml diff --git a/.github/release-files-spec.json b/.github/release-files-spec.json new file mode 100644 index 00000000..4ceba9f6 --- /dev/null +++ b/.github/release-files-spec.json @@ -0,0 +1,28 @@ +{ + "files": [ + { + "aql": { + "items.find": { + "$and": [ + { + "@build.name": "${buildname}", + "@build.number": "${buildnumber}", + "path": {"$match": "org*"} + }, + { + "$or": [ + { + "name": {"$match": "*.pom"} + }, + { + "name": {"$match": "*.jar"} + } + ] + } + ] + } + }, + "target": "nexus/" + } + ] +} diff --git a/.github/workflows/central-sync-create.yml b/.github/workflows/central-sync-create.yml new file mode 100644 index 00000000..6e7dc6c7 --- /dev/null +++ b/.github/workflows/central-sync-create.yml @@ -0,0 +1,61 @@ +name: Central Sync Create + +on: + workflow_dispatch: + inputs: + buildName: + description: "Artifactory build name" + required: true + buildNumber: + description: "Artifactory build number" + required: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + + # Setup jfrog cli + - uses: jfrog/setup-jfrog-cli@v1 + with: + version: 1.43.2 + env: + JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} + + # Extract build id from input + - name: Extract Build Id + run: | + echo JFROG_CLI_BUILD_NAME=${{ github.event.inputs.buildName }} >> $GITHUB_ENV + echo JFROG_CLI_BUILD_NUMBER=${{ github.event.inputs.buildNumber }} >> $GITHUB_ENV + + # Download released files + - name: Download Release Files + run: | + jfrog rt download \ + --server-id spring \ + --spec .github/release-files-spec.json \ + --spec-vars "buildname=$JFROG_CLI_BUILD_NAME;buildnumber=$JFROG_CLI_BUILD_NUMBER" + + # Create checksums, signatures and create staging repo on central and upload + - uses: jvalkeal/nexus-sync@main + id: nexus + with: + url: ${{ secrets.OSSRH_URL }} + username: ${{ secrets.OSSRH_USERNAME }} + password: ${{ secrets.OSSRH_PASSWORD }} + staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }} + create: true + upload: true + generate-checksums: true + generate-checksums-config: > + [ + { "type": "md5", "extension": "md5" }, + { "type": "sha1", "extension": "sha1" } + ] + pgp-sign: true + pgp-sign-passphrase: ${{ secrets.GPG_PASSPHRASE }} + pgp-sign-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + + # Print staging repo id + - name: Print Staging Repo Id + run: echo ${{ steps.nexus.outputs.staged-repository-id }} diff --git a/.gitignore b/.gitignore index d0117648..e382978d 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ target classes .sts4-cache .attach_pid* +nexus