diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000000..753dcd1e518 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,67 @@ +name: Release + +on: + workflow_dispatch: + inputs: + release-version: + description: 'Version to release, e.g. 5.19.0.RELEASE' + type: string + required: true + snapshot-version: + description: 'Next development version, e.g. 5.20.0.BUILD-SNAPSHOT' + type: string + required: true + +permissions: + contents: write + +concurrency: + group: release + cancel-in-progress: false + +jobs: + release: + if: ${{ github.repository == 'cloudfoundry/cf-java-client' && (github.ref == 'refs/heads/5.x.x' || github.ref == 'refs/heads/main') }} + runs-on: ubuntu-latest + timeout-minutes: 60 + env: + RELEASE_BRANCH: ${{ github.ref_name }} + RELEASE_VERSION: ${{ inputs.release-version }} + SNAPSHOT_VERSION: ${{ inputs.snapshot-version }} + steps: + - uses: actions/checkout@v7 + with: + submodules: recursive + - name: Set up Java + uses: actions/setup-java@v6 + with: + distribution: liberica + java-version: 8 + cache: maven + server-id: central + server-username: CENTRAL_USERNAME + server-password: CENTRAL_PASSWORD + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + # Leaves HEAD on the snapshot commit and the v tag on the release commit. + - name: Create release and snapshot commits + run: ci/create-release.sh "$RELEASE_VERSION" "$SNAPSHOT_VERSION" + - name: Deploy to Maven Central + env: + CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} + CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + run: | + git checkout --quiet "v$RELEASE_VERSION" + ./mvnw --batch-mode -Dmaven.test.skip=true deploy + git checkout --quiet - + - name: Push development version and tag + run: git push origin "HEAD:$RELEASE_BRANCH" "v$RELEASE_VERSION" + - name: Create GitHub release + env: + GH_TOKEN: ${{ github.token }} + run: gh release create "v$RELEASE_VERSION" --title "v$RELEASE_VERSION" --generate-notes diff --git a/ci/Dockerfile b/ci/Dockerfile deleted file mode 100644 index 8c8b0689925..00000000000 --- a/ci/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -ARG base_image=openjdk:8-jre -ARG script_image=springio/concourse-release-scripts:0.3.4 - -FROM ${script_image} - -FROM ${base_image} - -COPY --from=0 /concourse-release-scripts.jar /opt/ - -RUN apt-get update && apt-get install --no-install-recommends -y \ - ca-certificates \ - curl \ - jq \ - gnupg \ - && rm -rf /var/lib/apt/lists/* - -RUN curl -fL https://getcli.jfrog.io | sh && \ - mv jfrog /usr/local/bin/ diff --git a/ci/claim-environment.sh b/ci/claim-environment.sh deleted file mode 100755 index 7315345453b..00000000000 --- a/ci/claim-environment.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")"/../..) - -if [[ -d "${ROOT}"/om ]]; then - printf "➜ Expanding om\n" - tar xzf "${ROOT}"/om/om-linux-*.tar.gz -C "${ROOT}"/om - export PATH="${ROOT}"/om:${PATH} -fi - -printf "Claiming environment from %s\n" "${POOL}" - -CLAIM=$(curl \ - --fail \ - --location \ - --show-error \ - --silent \ - --header 'Accept: application/json' \ - --request "POST" \ - "https://environments.toolsmiths.cf-app.com/pooled_gcp_engineering_environments/claim?api_token=${API_TOKEN}&pool_name=${POOL}¬es=Claimed%20by%20Java%20Buildpack%20CI") - -printf "Claimed %s\n" "$(jq -n -r --argjson claim "${CLAIM}" '$claim.name')" - -CREDENTIALS=$(om \ - --target "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.url')" \ - --username "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.username')" \ - --password "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.password')" \ - credentials \ - --product-name cf \ - --credential-reference .uaa.admin_credentials \ - --format json) - - jq \ - -n -r \ - --argjson claim "${CLAIM}" \ - --argjson credentials "${CREDENTIALS}" \ - '{ name: $claim.name, username: $credentials.identity, password: $credentials.password }' \ - > "${ROOT}"/environment/cf-creds.json - - -CREDENTIALS=$(om \ - --target "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.url')" \ - --username "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.username')" \ - --password "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.password')" \ - credentials \ - --product-name cf \ - --credential-reference .uaa.admin_client_credentials \ - --format json) - - jq \ - -n -r \ - --argjson claim "${CLAIM}" \ - --argjson credentials "${CREDENTIALS}" \ - '{ client: $credentials.identity, secret: $credentials.password }' \ - > "${ROOT}"/environment/uaa-creds.json - -printf "Patching for TCP Routing Support\n" - -om \ - --target "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.url')" \ - --username "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.username')" \ - --password "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.password')" \ - staged-config \ - --product-name cf > /tmp/cf.yml - -TCP_ROUTES_LB="$(jq -n -r --argjson claim "${CLAIM}" '$claim.tcp_router_pool')" - -om \ - --target "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.url')" \ - --username "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.username')" \ - --password "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.password')" \ - configure-product \ - --config /tmp/cf.yml \ - --ops-file cf-java-client/ci/tcp-routes.yml \ - --var TCP_ROUTES_LB="tcp:${TCP_ROUTES_LB}" \ - --var DEFAULT_QUOTA_MEM_MB=${DEFAULT_QUOTA_MEM_MB} - -om \ - --target "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.url')" \ - --username "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.username')" \ - --password "$(jq -n -r --argjson claim "${CLAIM}" '$claim.ops_manager.password')" \ - apply-changes \ - -n cf - -printf "Environment updated with TCP Routes\n" diff --git a/ci/deploy.sh b/ci/deploy.sh deleted file mode 100755 index 285d4a24296..00000000000 --- a/ci/deploy.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -set -euox pipefail - -[[ -d $PWD/maven && ! -d $HOME/.m2 ]] && ln -s $PWD/maven $HOME/.m2 - -function clean_gpg { - FINGERPRINT=$(gpg --list-keys | head -4 | tail -1 | tr -d ' ') - gpg --batch --yes --delete-secret-keys "$FINGERPRINT" - gpg --batch --yes --delete-keys "$FINGERPRINT" -} - -trap clean_gpg EXIT -gpg --batch --import-options import-show --import <(echo "$MAVEN_GPG_PRIVATE_KEY") - -mkdir -p ~/.m2 -cat < ~/.m2/settings.xml - - - - gpg.passphrase - ${MAVEN_GPG_PASSPHRASE} - - - -EOF - -cd cf-java-client -./mvnw -Dmaven.test.skip=true -DcreateChecksum=true deploy diff --git a/ci/integration-test.sh b/ci/integration-test.sh deleted file mode 100755 index 0d56185de56..00000000000 --- a/ci/integration-test.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -# update & install jq -apt-get update && apt-get -y install jq - -[[ -d $PWD/maven && ! -d $HOME/.m2 ]] && ln -s $PWD/maven $HOME/.m2 - -ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")"/../..) - -if [[ -d "${ROOT}"/om ]]; then - printf "➜ Expanding om\n" - tar xzf "${ROOT}"/om/om-linux-*.tar.gz -C "${ROOT}"/om - export PATH="${ROOT}"/om:${PATH} -fi - -CF_CREDS=$(cat "${ROOT}"/environment/cf-creds.json) - -TEST_APIHOST=$(jq -n -r --argjson credentials "${CF_CREDS}" '$credentials.api_url') -export TEST_APIHOST - -TEST_ADMIN_USERNAME=$(jq -n -r --argjson credentials "${CF_CREDS}" '$credentials.username') -export TEST_ADMIN_USERNAME - -TEST_ADMIN_PASSWORD=$(jq -n -r --argjson credentials "${CF_CREDS}" '$credentials.password') -export TEST_ADMIN_PASSWORD - -UAA_CREDS=$(cat "${ROOT}"/environment/uaa-creds.json) - -TEST_ADMIN_CLIENTID=$(jq -n -r --argjson credentials "${UAA_CREDS}" '$credentials.client') -export TEST_ADMIN_CLIENTID - -TEST_ADMIN_CLIENTSECRET=$(jq -n -r --argjson credentials "${UAA_CREDS}" '$credentials.secret') -export TEST_ADMIN_CLIENTSECRET - -cd cf-java-client -./mvnw -P integration-test test diff --git a/ci/promote-to-maven-central.sh b/ci/promote-to-maven-central.sh deleted file mode 100755 index 9ed1a9515b0..00000000000 --- a/ci/promote-to-maven-central.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -export BUILD_INFO_LOCATION=$(pwd)/artifactory-repo/build-info.json - -java -jar /opt/concourse-release-scripts.jar publishToCentral 'RELEASE' "$BUILD_INFO_LOCATION" artifactory-repo - -echo "Sync complete" diff --git a/ci/tcp-routes.yml b/ci/tcp-routes.yml deleted file mode 100644 index 306d30ce691..00000000000 --- a/ci/tcp-routes.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -- type: replace - path: /product-properties/.properties.tcp_routing - value: - selected_option: enable - value: enable -- type: replace - path: /product-properties/.properties.tcp_routing.enable.request_timeout_in_seconds? - value: - value: 300 -- type: replace - path: /product-properties/.properties.tcp_routing.enable.reservable_ports? - value: - value: 1024-1123 -- type: replace - path: /resource-config/tcp_router/elb_names/- - value: "((TCP_ROUTES_LB))" -- type: replace - path: /resource-config/tcp_router/instances - value: automatic -- type: replace - path: /resource-config/compute/instances - value: 2 -- type: replace - path: /product-properties/.cloud_controller.default_quota_memory_limit_mb - value: - value: ((DEFAULT_QUOTA_MEM_MB)) diff --git a/ci/unclaim-environment.sh b/ci/unclaim-environment.sh deleted file mode 100755 index 9427782dbad..00000000000 --- a/ci/unclaim-environment.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")"/../..) - -CREDENTIALS=$(cat "${ROOT}"/environment/cf-creds.json) - -printf "Unclaiming %s\n" "$(jq -n -r --argjson credentials "${CREDENTIALS}" '$credentials.name')" - -curl \ - --fail \ - --location \ - --show-error \ - --silent \ - --request "POST" \ - "https://environments.toolsmiths.cf-app.com/pooled_gcp_engineering_environments/unclaim?api_token=${API_TOKEN}&name=$(jq -n -r --argjson credentials "${CREDENTIALS}" '$credentials.name')" diff --git a/ci/unit-test.sh b/ci/unit-test.sh deleted file mode 100755 index 18b4bf174a2..00000000000 --- a/ci/unit-test.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -[[ -d $PWD/maven && ! -d $HOME/.m2 ]] && ln -s $PWD/maven $HOME/.m2 - -cd cf-java-client -./mvnw -q package diff --git a/pom.xml b/pom.xml index 0c40fa6ca35..1da4e9a743b 100644 --- a/pom.xml +++ b/pom.xml @@ -244,28 +244,15 @@ - org.jfrog.buildinfo - artifactory-maven-plugin - 3.7.0 - false - - - build-info - - publish - - - - https://repo.spring.io - {{ARTIFACTORY_USERNAME}} - {{ARTIFACTORY_PASSWORD}} - {{ARTIFACTORY_REPO_KEY|"libs-release-local"}} - {{ARTIFACTORY_SNAPSHOT_REPO_KEY|"libs-snapshot-local"}} - *-tests.jar - - - - + org.sonatype.central + central-publishing-maven-plugin + 0.8.0 + true + + central + true + published + org.apache.maven.plugins