From 35ebff399d191936a192e321e1718b62f04e8ebc Mon Sep 17 00:00:00 2001 From: Dmitry Shanko Date: Wed, 21 Jun 2023 13:36:41 +0700 Subject: [PATCH 1/7] COS-268: GitHub actions (#36) Co-authored-by: DDashko Co-authored-by: Dmitry Dashko Co-authored-by: Dmitry Shanko --- .github/workflows/attach-artifact-release.yml | 31 ++++++++++++------- .github/workflows/build-release.yml | 18 +++++++++++ 2 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/build-release.yml diff --git a/.github/workflows/attach-artifact-release.yml b/.github/workflows/attach-artifact-release.yml index 38a05c68..21d4a7da 100644 --- a/.github/workflows/attach-artifact-release.yml +++ b/.github/workflows/attach-artifact-release.yml @@ -16,9 +16,26 @@ on: jobs: attach-to-release: name: Attach Artifact to Release - if: github.event.pull_request.merged == true + #if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'temurin' + cache: maven + + - name: Build with Maven + run: mvn package --file liquibase-couchbase/pom.xml -DskipTests + + - name: Publish Artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.get-artifact-id.outputs.artifact_id }}-artifacts + path: liquibase-couchbase/target/* + - run: sleep 30 - uses: actions/checkout@v3 @@ -35,20 +52,12 @@ jobs: id: get-artifact-id run: echo "artifact_id=$(mvn --file liquibase-couchbase/pom.xml help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV - - name: Download artifact - id: download-artifact - uses: dawidd6/action-download-artifact@v2 + - name: Download Artifacts + uses: actions/download-artifact@v2 with: - github_token: ${{secrets.BOT_TOKEN}} - workflow: test.yml - pr: ${{github.event.pull_request.number}} name: ${{ env.artifact_id }}-artifacts - path: ./assets - repo: ${{ github.repository }} check_artifacts: true - skip_unpack: false if_no_artifact_found: fail - workflow_conclusion: "" - name: Get Release Tag id: get-release-tag diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 00000000..b1531e9d --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,18 @@ +name: Build Release + +on: + workflow_dispatch: + +jobs: + build-release: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Build with Maven + run: mvn package --file liquibase-couchbase/pom.xml -DskipTests + + - name: Publish Artifacts + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.get-artifact-id.outputs.artifact_id }}-artifacts + path: liquibase-couchbase/target/* \ No newline at end of file From 6fbf0edb91b95c6d70c49501b7ad13600c885e63 Mon Sep 17 00:00:00 2001 From: Dmitry Shanko Date: Wed, 21 Jun 2023 14:49:49 +0700 Subject: [PATCH 2/7] COS-268: GitHub actions (#37) Co-authored-by: DDashko Co-authored-by: Dmitry Dashko Co-authored-by: Dmitry Shanko --- .github/workflows/attach-artifact-release.yml | 6 ++---- .github/workflows/build-release.yml | 18 ------------------ 2 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 .github/workflows/build-release.yml diff --git a/.github/workflows/attach-artifact-release.yml b/.github/workflows/attach-artifact-release.yml index 21d4a7da..7edd908b 100644 --- a/.github/workflows/attach-artifact-release.yml +++ b/.github/workflows/attach-artifact-release.yml @@ -33,7 +33,7 @@ jobs: - name: Publish Artifacts uses: actions/upload-artifact@v2 with: - name: ${{ steps.get-artifact-id.outputs.artifact_id }}-artifacts + name: liquibase-couchbase path: liquibase-couchbase/target/* - run: sleep 30 @@ -55,9 +55,7 @@ jobs: - name: Download Artifacts uses: actions/download-artifact@v2 with: - name: ${{ env.artifact_id }}-artifacts - check_artifacts: true - if_no_artifact_found: fail + name: liquibase-couchbase - name: Get Release Tag id: get-release-tag diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml deleted file mode 100644 index b1531e9d..00000000 --- a/.github/workflows/build-release.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Build Release - -on: - workflow_dispatch: - -jobs: - build-release: - name: Create Release - runs-on: ubuntu-latest - steps: - - name: Build with Maven - run: mvn package --file liquibase-couchbase/pom.xml -DskipTests - - - name: Publish Artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ steps.get-artifact-id.outputs.artifact_id }}-artifacts - path: liquibase-couchbase/target/* \ No newline at end of file From 0d96bd7f8bb54e6168bd7b614c42f6c1b0bae182 Mon Sep 17 00:00:00 2001 From: Dmitry Shanko Date: Thu, 22 Jun 2023 14:29:48 +0700 Subject: [PATCH 3/7] COS-268: Github actions (#38) Co-authored-by: Dmitry Shanko --- .github/workflows/attach-artifact-release.yml | 154 ++++++++++-------- cli-test/pom.xml | 2 +- liquibase-couchbase/pom.xml | 2 +- pom.xml | 1 + .../pom.xml | 4 +- .../pom.xml | 4 +- test-project/pom.xml | 6 +- 7 files changed, 94 insertions(+), 79 deletions(-) diff --git a/.github/workflows/attach-artifact-release.yml b/.github/workflows/attach-artifact-release.yml index 7edd908b..42f56039 100644 --- a/.github/workflows/attach-artifact-release.yml +++ b/.github/workflows/attach-artifact-release.yml @@ -1,4 +1,4 @@ -name: Attach Artifact to Release +name: Build and Attach Artifacts to Release on: workflow_dispatch: @@ -14,85 +14,99 @@ on: required: true jobs: - attach-to-release: - name: Attach Artifact to Release - #if: github.event.pull_request.merged == true + build-and-attach-artifacts: + name: Build and attach maven artifacts runs-on: ubuntu-latest + outputs: + extensionVersion: ${{ steps.collect-data.outputs.extensionVersion }} steps: - - uses: actions/checkout@v3 - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'temurin' - cache: maven + - uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: 8 + distribution: 'temurin' + cache: 'maven' - - name: Build with Maven - run: mvn package --file liquibase-couchbase/pom.xml -DskipTests + - name: Build with Maven + run: mvn package --file liquibase-couchbase/pom.xml -DskipTests - - name: Publish Artifacts - uses: actions/upload-artifact@v2 - with: - name: liquibase-couchbase - path: liquibase-couchbase/target/* + - name: Get Artifact ID + id: get-artifact-id + run: echo "artifact_id=$(mvn --file liquibase-couchbase/pom.xml help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV - - run: sleep 30 - - uses: actions/checkout@v3 + - name: Get Artifact Version + id: get-artifact-version + run: echo "artifact_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - name: Get Reusable Script Files - run: | - curl -o $PWD/.github/get_draft_release.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.1/.github/get_draft_release.sh - curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.1/.github/sign_artifact.sh - curl -o $PWD/.github/upload_asset.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.1/.github/upload_asset.sh - chmod +x $PWD/.github/get_draft_release.sh - chmod +x $PWD/.github/sign_artifact.sh - chmod +x $PWD/.github/upload_asset.sh + - name: Collect Data + id: collect-data + uses: actions/github-script@v4 + with: + script: | + core.setOutput("extensionVersion", '${{ env.artifact_version }}'); - - name: Get Artifact ID - id: get-artifact-id - run: echo "artifact_id=$(mvn --file liquibase-couchbase/pom.xml help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV + - name: Echo Build Info + id: echo-version + run: | + echo "Get Extension artifacts ${{ env.artifact_id }}-${{ env.artifact_version }}" - - name: Download Artifacts - uses: actions/download-artifact@v2 - with: - name: liquibase-couchbase + - name: Publish Artifacts + uses: actions/upload-artifact@v2 + with: + name: liquibase-couchbase + path: liquibase-couchbase/target/* - - name: Get Release Tag - id: get-release-tag - run: echo "release_tag=$(./.github/get_draft_release.sh TAG)" >> $GITHUB_ENV - env: - GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} + - name: Get Reusable Script Files + run: | + curl -o $PWD/.github/get_draft_release.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.1/.github/get_draft_release.sh + curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.1/.github/sign_artifact.sh + curl -o $PWD/.github/upload_asset.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.1/.github/upload_asset.sh + chmod +x $PWD/.github/get_draft_release.sh + chmod +x $PWD/.github/sign_artifact.sh + chmod +x $PWD/.github/upload_asset.sh - - name: Delete Outdated Files from Draft Release - id: delete-outdated-release-asset - uses: mknejp/delete-release-assets@v1 - with: - token: ${{ secrets.BOT_TOKEN }} - tag: ${{ env.release_tag }} - fail-if-no-assets: false - fail-if-no-release: false - assets: "${{ env.artifact_id }}-*" + - name: Download Artifacts + uses: actions/download-artifact@v2 + with: + name: liquibase-couchbase - - name: Import GPG key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v5 - with: - gpg_private_key: ${{ secrets.GPG_SECRET }} - passphrase: ${{ secrets.GPG_PASSPHRASE }} + - name: Get Release Tag + id: get-release-tag + run: echo "release_tag=$(./.github/get_draft_release.sh TAG)" >> $GITHUB_ENV + env: + GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} - - name: Sign Files for Draft Release - run: | - gpg -K - version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) - ./.github/sign_artifact.sh ./assets/${{ env.artifact_id }}-${version}.jar - ./.github/sign_artifact.sh ./assets/${{ env.artifact_id }}-${version}.pom - ./.github/sign_artifact.sh ./assets/${{ env.artifact_id }}-${version}-javadoc.jar - ./.github/sign_artifact.sh ./assets/${{ env.artifact_id }}-${version}-sources.jar + - name: Delete Outdated Files from Draft Release + id: delete-outdated-release-asset + uses: mknejp/delete-release-assets@v1 + with: + token: ${{ secrets.BOT_TOKEN }} + tag: ${{ env.release_tag }} + fail-if-no-assets: false + fail-if-no-release: false + assets: "${{ env.artifact_id }}-*" - - name: Attach Files to Draft Release - id: upload-release-asset - run: ./.github/upload_asset.sh $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) - env: - GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} - ASSET_NAME_PREFIX: "${{ env.artifact_id }}-" - ASSET_DIR: ./assets \ No newline at end of file + - name: Import GPG key + id: import_gpg + uses: crazy-max/ghaction-import-gpg@v5 + with: + gpg_private_key: ${{ secrets.GPG_SECRET }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + + - name: Sign Files for Draft Release + run: | + gpg -K + version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + ./.github/sign_artifact.sh ./${{ env.artifact_id }}-${version}.jar + ./.github/sign_artifact.sh ./${{ env.artifact_id }}-${version}.pom + ./.github/sign_artifact.sh ./${{ env.artifact_id }}-${version}-javadoc.jar + ./.github/sign_artifact.sh ./${{ env.artifact_id }}-${version}-sources.jar + + - name: Attach Files to Draft Release + id: upload-release-asset + run: ./.github/upload_asset.sh $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + env: + GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} + ASSET_NAME_PREFIX: "${{ env.artifact_id }}-" + ASSET_DIR: . \ No newline at end of file diff --git a/cli-test/pom.xml b/cli-test/pom.xml index 3ebfaa9b..2757183d 100644 --- a/cli-test/pom.xml +++ b/cli-test/pom.xml @@ -11,7 +11,7 @@ cli-test - 0.1.0-SNAPSHOT + ${build.version} jar diff --git a/liquibase-couchbase/pom.xml b/liquibase-couchbase/pom.xml index 50205519..89601727 100644 --- a/liquibase-couchbase/pom.xml +++ b/liquibase-couchbase/pom.xml @@ -11,7 +11,7 @@ liquibase-couchbase - 1.0.0 + ${build.version} jar diff --git a/pom.xml b/pom.xml index 97dfa609..07d34a31 100644 --- a/pom.xml +++ b/pom.xml @@ -77,6 +77,7 @@ + 0.1.0-ER UTF-8 1.8 1.8 diff --git a/spring-boot-starter-liquibase-couchbase-test/pom.xml b/spring-boot-starter-liquibase-couchbase-test/pom.xml index 7e8cc8ec..33daff80 100644 --- a/spring-boot-starter-liquibase-couchbase-test/pom.xml +++ b/spring-boot-starter-liquibase-couchbase-test/pom.xml @@ -11,7 +11,7 @@ spring-boot-starter-liquibase-couchbase-test - 0.1.0-SNAPSHOT + ${build.version} UTF-8 @@ -44,7 +44,7 @@ org.liquibase.ext spring-boot-starter-liquibase-couchbase - 0.1.0-SNAPSHOT + ${build.version} com.couchbase.client diff --git a/spring-boot-starter-liquibase-couchbase/pom.xml b/spring-boot-starter-liquibase-couchbase/pom.xml index e7785a41..d03011f7 100644 --- a/spring-boot-starter-liquibase-couchbase/pom.xml +++ b/spring-boot-starter-liquibase-couchbase/pom.xml @@ -11,7 +11,7 @@ spring-boot-starter-liquibase-couchbase - 0.1.0-SNAPSHOT + ${build.version} UTF-8 @@ -35,7 +35,7 @@ org.liquibase.ext liquibase-couchbase - 0.1.0-SNAPSHOT + ${build.version} org.projectlombok diff --git a/test-project/pom.xml b/test-project/pom.xml index 241d3fea..2f4f7123 100644 --- a/test-project/pom.xml +++ b/test-project/pom.xml @@ -11,7 +11,7 @@ test-project - 0.1.0-SNAPSHOT + ${build.version} jar @@ -27,7 +27,7 @@ org.liquibase.ext liquibase-couchbase - 0.1.0-SNAPSHOT + ${build.version} @@ -89,7 +89,7 @@ org.liquibase.ext liquibase-couchbase - 0.1.0-SNAPSHOT + ${build.version} From 4ed9c7618371075adcb2a09eece9c6d95569a070 Mon Sep 17 00:00:00 2001 From: Dmitry Shanko Date: Thu, 22 Jun 2023 15:54:48 +0700 Subject: [PATCH 4/7] Cos 268 GitHub actions (#39) Co-authored-by: Dmitry Shanko --- .github/workflows/attach-artifact-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/attach-artifact-release.yml b/.github/workflows/attach-artifact-release.yml index 42f56039..f9ca087b 100644 --- a/.github/workflows/attach-artifact-release.yml +++ b/.github/workflows/attach-artifact-release.yml @@ -37,7 +37,7 @@ jobs: - name: Get Artifact Version id: get-artifact-version - run: echo "artifact_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + run: echo "artifact_version=$(mvn --file liquibase-couchbase/pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - name: Collect Data id: collect-data From b0c5904b6d682b93d9a521414b0350a98f572a63 Mon Sep 17 00:00:00 2001 From: Dmitry Shanko Date: Thu, 22 Jun 2023 16:48:22 +0700 Subject: [PATCH 5/7] COS-268: Github actions (#40) Co-authored-by: Dmitry Shanko --- .github/workflows/attach-artifact-release.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/attach-artifact-release.yml b/.github/workflows/attach-artifact-release.yml index f9ca087b..f6888ce0 100644 --- a/.github/workflows/attach-artifact-release.yml +++ b/.github/workflows/attach-artifact-release.yml @@ -97,15 +97,14 @@ jobs: - name: Sign Files for Draft Release run: | gpg -K - version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) - ./.github/sign_artifact.sh ./${{ env.artifact_id }}-${version}.jar - ./.github/sign_artifact.sh ./${{ env.artifact_id }}-${version}.pom - ./.github/sign_artifact.sh ./${{ env.artifact_id }}-${version}-javadoc.jar - ./.github/sign_artifact.sh ./${{ env.artifact_id }}-${version}-sources.jar + ./.github/sign_artifact.sh ./${{ env.artifact_id }}-${{ env.artifact_version }}.jar + ./.github/sign_artifact.sh ./${{ env.artifact_id }}-${{ env.artifact_version }}.pom + ./.github/sign_artifact.sh ./${{ env.artifact_id }}-${{ env.artifact_version }}-javadoc.jar + ./.github/sign_artifact.sh ./${{ env.artifact_id }}-${{ env.artifact_version }}-sources.jar - name: Attach Files to Draft Release id: upload-release-asset - run: ./.github/upload_asset.sh $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + run: ./.github/upload_asset.sh ${{ env.artifact_version }} env: GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} ASSET_NAME_PREFIX: "${{ env.artifact_id }}-" From 15d6f80701bc154aa366b74a1eda5284a4ecb058 Mon Sep 17 00:00:00 2001 From: Dmitry Shanko Date: Fri, 23 Jun 2023 11:43:05 +0700 Subject: [PATCH 6/7] COS-268: GitHub actions (#41) Co-authored-by: Dmitry Shanko --- .github/workflows/attach-artifact-release.yml | 111 ------------ .../create-release-with-artifacts.yml | 162 ++++++++++++++++++ .github/workflows/create-release.yml | 15 -- .github/workflows/release-published.yml | 101 ++++++----- 4 files changed, 222 insertions(+), 167 deletions(-) delete mode 100644 .github/workflows/attach-artifact-release.yml create mode 100644 .github/workflows/create-release-with-artifacts.yml delete mode 100644 .github/workflows/create-release.yml diff --git a/.github/workflows/attach-artifact-release.yml b/.github/workflows/attach-artifact-release.yml deleted file mode 100644 index f6888ce0..00000000 --- a/.github/workflows/attach-artifact-release.yml +++ /dev/null @@ -1,111 +0,0 @@ -name: Build and Attach Artifacts to Release - -on: - workflow_dispatch: - secrets: - BOT_TOKEN: - description: 'BOT_TOKEN from the caller workflow' - required: true - GPG_SECRET: - description: 'GPG_SECRET from the caller workflow' - required: true - GPG_PASSPHRASE: - description: 'GPG_PASSPHRASE from the caller workflow' - required: true - -jobs: - build-and-attach-artifacts: - name: Build and attach maven artifacts - runs-on: ubuntu-latest - outputs: - extensionVersion: ${{ steps.collect-data.outputs.extensionVersion }} - steps: - - uses: actions/checkout@v3 - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: 8 - distribution: 'temurin' - cache: 'maven' - - - name: Build with Maven - run: mvn package --file liquibase-couchbase/pom.xml -DskipTests - - - name: Get Artifact ID - id: get-artifact-id - run: echo "artifact_id=$(mvn --file liquibase-couchbase/pom.xml help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV - - - name: Get Artifact Version - id: get-artifact-version - run: echo "artifact_version=$(mvn --file liquibase-couchbase/pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - - name: Collect Data - id: collect-data - uses: actions/github-script@v4 - with: - script: | - core.setOutput("extensionVersion", '${{ env.artifact_version }}'); - - - name: Echo Build Info - id: echo-version - run: | - echo "Get Extension artifacts ${{ env.artifact_id }}-${{ env.artifact_version }}" - - - name: Publish Artifacts - uses: actions/upload-artifact@v2 - with: - name: liquibase-couchbase - path: liquibase-couchbase/target/* - - - name: Get Reusable Script Files - run: | - curl -o $PWD/.github/get_draft_release.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.1/.github/get_draft_release.sh - curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.1/.github/sign_artifact.sh - curl -o $PWD/.github/upload_asset.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.1/.github/upload_asset.sh - chmod +x $PWD/.github/get_draft_release.sh - chmod +x $PWD/.github/sign_artifact.sh - chmod +x $PWD/.github/upload_asset.sh - - - name: Download Artifacts - uses: actions/download-artifact@v2 - with: - name: liquibase-couchbase - - - name: Get Release Tag - id: get-release-tag - run: echo "release_tag=$(./.github/get_draft_release.sh TAG)" >> $GITHUB_ENV - env: - GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} - - - name: Delete Outdated Files from Draft Release - id: delete-outdated-release-asset - uses: mknejp/delete-release-assets@v1 - with: - token: ${{ secrets.BOT_TOKEN }} - tag: ${{ env.release_tag }} - fail-if-no-assets: false - fail-if-no-release: false - assets: "${{ env.artifact_id }}-*" - - - name: Import GPG key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v5 - with: - gpg_private_key: ${{ secrets.GPG_SECRET }} - passphrase: ${{ secrets.GPG_PASSPHRASE }} - - - name: Sign Files for Draft Release - run: | - gpg -K - ./.github/sign_artifact.sh ./${{ env.artifact_id }}-${{ env.artifact_version }}.jar - ./.github/sign_artifact.sh ./${{ env.artifact_id }}-${{ env.artifact_version }}.pom - ./.github/sign_artifact.sh ./${{ env.artifact_id }}-${{ env.artifact_version }}-javadoc.jar - ./.github/sign_artifact.sh ./${{ env.artifact_id }}-${{ env.artifact_version }}-sources.jar - - - name: Attach Files to Draft Release - id: upload-release-asset - run: ./.github/upload_asset.sh ${{ env.artifact_version }} - env: - GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} - ASSET_NAME_PREFIX: "${{ env.artifact_id }}-" - ASSET_DIR: . \ No newline at end of file diff --git a/.github/workflows/create-release-with-artifacts.yml b/.github/workflows/create-release-with-artifacts.yml new file mode 100644 index 00000000..88d81be4 --- /dev/null +++ b/.github/workflows/create-release-with-artifacts.yml @@ -0,0 +1,162 @@ +name: Create Draft Release with Artifacts + +on: + workflow_dispatch: + secrets: + BOT_TOKEN: + description: 'BOT_TOKEN from the caller workflow' + required: true + GPG_SECRET: + description: 'GPG_SECRET from the caller workflow' + required: true + GPG_PASSPHRASE: + description: 'GPG_PASSPHRASE from the caller workflow' + required: true + +jobs: + build: + name: Build Maven Artifacts + runs-on: ubuntu-latest + outputs: + artifactId: ${{ steps.collect-data.outputs.artifactId }} + artifactVersion: ${{ steps.collect-data.outputs.artifactVersion }} + releaseSha: ${{ steps.collect-data.outputs.releaseSha }} + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: 8 + distribution: 'temurin' + cache: 'maven' + + - name: Build with Maven + run: mvn package --file liquibase-couchbase/pom.xml -DskipTests + + - name: Get Artifact ID + id: get-artifact-id + run: echo "artifact_id=$(mvn --file liquibase-couchbase/pom.xml help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV + + - name: Get Artifact Version + id: get-artifact-version + run: echo "artifact_version=$(mvn --file liquibase-couchbase/pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Get release SHA + id: get-release-sha + run: echo "releaseSha=$(git rev-parse HEAD)" >> $GITHUB_ENV + + - name: Collect Data + id: collect-data + uses: actions/github-script@v4 + with: + script: | + core.setOutput("artifactId", '${{ env.artifact_id }}'); + core.setOutput("artifactVersion", '${{ env.artifact_version }}'); + core.setOutput("releaseSha", '${{ env.releaseSha }}'); + + - name: Echo Build Info + id: echo-version + run: | + echo "Get Extension artifacts ${{ env.artifact_id }}-${{ env.artifact_version }}" + + - name: Publish Artifacts + uses: actions/upload-artifact@v2 + with: + name: liquibase-couchbase + path: liquibase-couchbase/target/* + + release: + name: Create Release with Artifacts + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v3 + + - name: Get Reusable Script Files + run: | + curl -o $PWD/.github/get_draft_release.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.1/.github/get_draft_release.sh + curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.1/.github/sign_artifact.sh + curl -o $PWD/.github/upload_asset.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.1/.github/upload_asset.sh + chmod +x $PWD/.github/get_draft_release.sh + chmod +x $PWD/.github/sign_artifact.sh + chmod +x $PWD/.github/upload_asset.sh + + - name: Download Artifacts + uses: actions/download-artifact@v2 + with: + name: liquibase-couchbase + + - name: Prepare Artifact Name + id: artifact-name + run: echo "artifactName=${{ needs.build.outputs.artifactId }}-${{ needs.build.outputs.artifactVersion }}" >> $GITHUB_ENV + + - name: Create Tag Name + id: tag-name + run: echo "tagName=${{ needs.build.outputs.artifactVersion }}" >> $GITHUB_ENV + + - name: Echo Info + id: echo-version + run: | + echo "Artifacts: ${{ env.artifactName }}" + echo "Tag Name: ${{ env.tagName }}" + + - name: Create Draft Release + uses: softprops/action-gh-release@v1 + with: + target_commitish: ${{ needs.build.outputs.releaseSha }} + name: v${{ needs.build.outputs.artifactVersion }} + tag_name: ${{ env.tagName }} + draft: true + body: Liquibase Couchbase extension v${{ needs.build.outputs.artifactVersion }} + files: liquibase-couchbase + env: + GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} + + - name: Delete Outdated Files from Draft Release + id: delete-outdated-release-asset + uses: mknejp/delete-release-assets@v1 + with: + token: ${{ secrets.BOT_TOKEN }} + tag: ${{ env.tagName }} + fail-if-no-assets: false + fail-if-no-release: false + assets: "${{ needs.build.outputs.artifactId }}-*" + + - name: Import GPG key + id: import_gpg + uses: crazy-max/ghaction-import-gpg@v5 + with: + gpg_private_key: ${{ secrets.GPG_SECRET }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + + - name: Generate MD5 checksum + run: | + md5sum ./${{ env.artifactName }}.jar > ./${{ env.artifactName }}.jar.md5 + md5sum ./${{ env.artifactName }}.pom > ./${{ env.artifactName }}.pom.md5 + md5sum ./${{ env.artifactName }}-javadoc.jar > ./${{ env.artifactName }}-javadoc.jar.md5 + md5sum ./${{ env.artifactName }}-sources.jar > ./${{ env.artifactName }}-sources.jar.md5 + + - name: Generate SHA-1 checksum + run: | + sha1sum ./${{ env.artifactName }}.jar > ./${{ env.artifactName }}.jar.sha1 + sha1sum ./${{ env.artifactName }}.pom > ./${{ env.artifactName }}.pom.sha1 + sha1sum ./${{ env.artifactName }}-javadoc.jar > ./${{ env.artifactName }}-javadoc.jar.sha1 + sha1sum ./${{ env.artifactName }}-sources.jar > ./${{ env.artifactName }}-sources.jar.sha1 + + - name: Sign Files for Draft Release + run: | + gpg -K + passphrase="${{ secrets.GPG_PASSPHRASE }}" + export GPG_TTY=$(tty) + echo "$passphrase" | gpg --batch --pinentry-mode loopback --passphrase-fd 0 --sign --armor --detach-sign ./${{ env.artifactName }}.jar + echo "$passphrase" | gpg --batch --pinentry-mode loopback --passphrase-fd 0 --sign --armor --detach-sign ./${{ env.artifactName }}.pom + echo "$passphrase" | gpg --batch --pinentry-mode loopback --passphrase-fd 0 --sign --armor --detach-sign ./${{ env.artifactName }}-javadoc.jar + echo "$passphrase" | gpg --batch --pinentry-mode loopback --passphrase-fd 0 --sign --armor --detach-sign ./${{ env.artifactName }}-sources.jar + + - name: Attach Files to Draft Release + id: upload-release-asset + run: ./.github/upload_asset.sh ${{ needs.build.outputs.artifactVersion }} + env: + GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} + ASSET_NAME_PREFIX: "${{ needs.build.outputs.artifactId }}-" + ASSET_DIR: . \ No newline at end of file diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml deleted file mode 100644 index cfa1d94c..00000000 --- a/.github/workflows/create-release.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Create Release - -on: - workflow_dispatch: - -jobs: - create-release: - name: Create Release - runs-on: ubuntu-latest - steps: - - name: Create Release Draft - id: create-release - uses: release-drafter/release-drafter@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release-published.yml b/.github/workflows/release-published.yml index b7b604b0..bba7c0fb 100644 --- a/.github/workflows/release-published.yml +++ b/.github/workflows/release-published.yml @@ -2,8 +2,12 @@ name: Release Extension to Sonatype on: workflow_dispatch: + inputs: + releaseVersion: + description: 'Release Version' + required: true release: - types: [published] + types: [ published ] secrets: SONATYPE_USERNAME: description: 'SONATYPE_USERNAME from the caller workflow' @@ -16,43 +20,58 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - - name: Get Artifact ID - id: get-artifact-id - run: echo "artifact_id=$(mvn --file liquibase-couchbase/pom.xml help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV - - - name: Download Release Artifacts - uses: robinraju/release-downloader@v1.6 - with: - tag: "${{ github.event.release.tag_name }}" - filename: "${{ env.artifact_id }}-*" - out-file-path: "." - - - name: Set up Java for publishing to Maven Central Repository - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - cache: 'maven' - server-id: sonatype-nexus-staging - server-username: MAVEN_USERNAME - server-password: MAVEN_PASSWORD - -# - name: Publish to Maven Central -# env: -# MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} -# MAVEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN }} -# run: | -# version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) -# mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file \ -# -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \ -# -DrepositoryId=sonatype-nexus-staging \ -# -DpomFile=${{ env.artifact_id }}-${version}.pom \ -# -DgeneratePom=false \ -# -Dfile=${{ env.artifact_id }}-${version}.jar \ -# -Dsources=${{ env.artifact_id }}-${version}-sources.jar \ -# -Djavadoc=${{ env.artifact_id }}-${version}-javadoc.jar \ -# -Dfiles=${{ env.artifact_id }}-${version}.jar.asc,${{ env.artifact_id }}-${version}-sources.jar.asc,${{ env.artifact_id }}-${version}-javadoc.jar.asc,${{ env.artifact_id }}-${version}.pom.asc \ -# -Dtypes=jar.asc,jar.asc,jar.asc,pom.asc \ -# -Dclassifiers=,sources,javadoc, \ No newline at end of file + - uses: actions/checkout@v3 + + - name: Collect Env Data + id: get-env-data + run: | + echo "artifact_id=$(mvn --file liquibase-couchbase/pom.xml help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV + echo "artifact_version=${{ inputs.releaseVersion }}" >> $GITHUB_ENV + echo "tag_name=${{ inputs.releaseVersion }}" >> $GITHUB_ENV + echo "artifact_name=${{ env.artifact_id }}-${{ env.artifact_version }}" >> $GITHUB_ENV + + - name: Collect Artifact Name + id: get-artifact-name + run: echo "artifact_name=${{ env.artifact_id }}-${{ env.artifact_version }}" >> $GITHUB_ENV + + - name: Echo Build Info + id: echo-info + run: | + echo "Artifact Id: ${{ env.artifact_id }}" + echo "Artifact Version: ${{ env.artifact_version }}" + echo "Artifact Full Name: ${{ env.artifact_name }}" + echo "Tag Name: ${{ env.tag_name }}" + + - name: Download Release Artifacts + uses: robinraju/release-downloader@v1.6 + with: + tag: "${{ env.tag_name }}" + filename: "${{ env.artifact_id }}-*" + out-file-path: "." + + - name: Set up Java for publishing to Maven Central Repository + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: 'maven' + server-id: sonatype-nexus-staging + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + + - name: Publish to Maven Central + env: + MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN }} + run: | + mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file \ + -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \ + -DrepositoryId=sonatype-nexus-staging \ + -DpomFile=${{ env.artifact_name }}.pom \ + -DgeneratePom=false \ + -Dfile=${{ env.artifact_name }}.jar \ + -Dsources=${{ env.artifact_name }}-sources.jar \ + -Djavadoc=${{ env.artifact_name }}-javadoc.jar \ + -Dfiles=${{ env.artifact_name }}.jar.asc,${{ env.artifact_name }}-sources.jar.asc,${{ env.artifact_name }}-javadoc.jar.asc,${{ env.artifact_name }}.pom.asc \ + -Dtypes=jar.asc,jar.asc,jar.asc,pom.asc \ + -Dclassifiers=,sources,javadoc, \ No newline at end of file From d9f5e01d6e4e092b677ae47c365c960666dace4d Mon Sep 17 00:00:00 2001 From: Dmitry Shanko Date: Sat, 24 Jun 2023 08:51:11 +0700 Subject: [PATCH 7/7] Release publish --- .github/workflows/release-published.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-published.yml b/.github/workflows/release-published.yml index bba7c0fb..a293c6e2 100644 --- a/.github/workflows/release-published.yml +++ b/.github/workflows/release-published.yml @@ -69,6 +69,7 @@ jobs: -DrepositoryId=sonatype-nexus-staging \ -DpomFile=${{ env.artifact_name }}.pom \ -DgeneratePom=false \ + -Dbuild.version=${{ env.artifact_version }} \ -Dfile=${{ env.artifact_name }}.jar \ -Dsources=${{ env.artifact_name }}-sources.jar \ -Djavadoc=${{ env.artifact_name }}-javadoc.jar \