From 5efe65a176d5de0c6cc6761d7be28faeadee3576 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Date: Tue, 25 Jun 2024 14:04:26 +0200 Subject: [PATCH] DAT-17770 Package BQ commercial jar inside liquibase tar ball & zip (#223) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🔧 (extension-attach-artifact-release.yml): Add step to get artifact ID and set it as an environment variable 🔧 (extension-attach-artifact-release.yml): Modify script to check and download artifacts based on package version 🔧 (extension-attach-artifact-release.yml): Conditionally sign files for draft release only if artifact is not found * 🔧 (extension-attach-artifact-release.yml): update PACKAGE_NAME variable to use github.repo instead of github.repository for consistency and clarity * 📝 (extension-attach-artifact-release.yml): update PACKAGE_NAME to use the repository name from the event payload for consistency * 📝 (extension-attach-artifact-release.yml): add debug logs to display artifact checking and response for better troubleshooting * 🐛 (extension-attach-artifact-release.yml): fix the URL construction to correctly reference the artifact variable instead of a fixed version ID * 🔧 (extension-attach-artifact-release.yml): refactor artifact download process to use 'mvn dependency:get' command for improved efficiency and reliability * 🔧 (extension-attach-artifact-release.yml): Comment out unused workflow steps to improve readability and reduce clutter. * 🐛 (extension-attach-artifact-release.yml): fix a typo in the directory path causing a build failure * 🔧 (extension-attach-artifact-release.yml): refactor artifact download process to check for existence before proceeding with further actions * 🔧 (extension-attach-artifact-release.yml): add support for downloading artifact sources, javadoc, and pom files along with the main jar file * 🔧 (extension-attach-artifact-release.yml): Refactor artifact download and copying process to handle failures more gracefully 🔧 (extension-attach-artifact-release.yml): Update artifact signing process to only sign new artifacts, not existing ones 🔧 (server.ts): update ASSET_DIR configuration to point to ./target directory * 🔧 (extension-attach-artifact-release.yml): Use environment variable ARTIFACT_NAME to store the repository name for better readability and consistency in artifact handling. * 🔧 (extension-attach-artifact-release.yml): remove unnecessary conditional check for signing files as existing GPM artifacts are already signed. * 🔧 (extension-attach-artifact-release.yml): remove unnecessary logging of ARTIFACT_FOUND variable to improve workflow readability * 📝 (extension-attach-artifact-release.yml): comment out GPG key import and file signing steps for draft release to prevent unnecessary execution and speed up the workflow. * 📝 (extension-attach-artifact-release.yml): Uncomment GPG key import and file signing steps for draft release preparation. * 🔧 (extension-attach-artifact-release.yml): simplify artifact copying process by directly moving files from local Maven repository to target directory * 🔧 (extension-attach-artifact-release.yml): refactor build-release-artifacts step to only run if ARTIFACT_FOUND is '0' to avoid unnecessary artifact building when artifact is already available in the repository * 🔧 (extension-attach-artifact-release.yml): update script to extract release version from pom.xml file for artifact deployment process * 🔧 (extension-attach-artifact-release.yml): update RELEASE_VERSION extraction logic to handle multiple occurrences of tag in pom.xml file * 🔧 (extension-attach-artifact-release.yml): use variable RELEASE_VERSION consistently instead of env.RELEASE_VERSION for better readability and maintainability * ♻️ (extension-attach-artifact-release.yml): remove '-SNAPSHOT' suffix from the version in pom.xml to prepare for release * 🔧 (extension-attach-artifact-release.yml): remove '-SNAPSHOT' suffix from version in pom.xml to prepare for release. * 📝 (extension-attach-artifact-release.yml): add commands to list files before and after moving artifacts for debugging purposes * 🔧 (extension-attach-artifact-release.yml): add support to download additional artifact files (pom, sources, javadoc) for the extension during the release process * 🔧 (extension-attach-artifact-release.yml): remove unnecessary ls commands and clean up artifact handling process * 🔧 (extension-attach-artifact-release.yml): Remove unnecessary steps to retrieve project version and set it as an environment variable * 🔧 (extension-attach-artifact-release.yml): improve error messages for artifact download failures and update artifact type descriptions for better clarity * 🐛 (extension-attach-artifact-release.yml): fix incorrect conditional check for artifact existence to properly handle the case when no artifacts are found * 🐛 (extension-attach-artifact-release.yml): fix conditional check for ARTIFACT_FOUND to properly handle boolean values instead of string comparison * ✨ (extension-attach-artifact-release.yml): add flag ARTIFACT_FOUND to GitHub environment to track artifact availability during workflow execution * 🔧 (extension-attach-artifact-release.yml): update if condition syntax to use double square brackets for improved compatibility and readability * 🔧 (extension-attach-artifact-release.yml): improve artifact check logic and add debug output for better troubleshooting * 🔧 (extension-attach-artifact-release.yml): Improve artifact download process and handling of missing artifacts. Remove unnecessary checks and simplify artifact download logic. * 🔧 (extension-attach-artifact-release.yml): remove unnecessary ls command to clean up workflow and improve readability --- .../extension-attach-artifact-release.yml | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/workflows/extension-attach-artifact-release.yml b/.github/workflows/extension-attach-artifact-release.yml index 1b27254f..633e806a 100644 --- a/.github/workflows/extension-attach-artifact-release.yml +++ b/.github/workflows/extension-attach-artifact-release.yml @@ -101,22 +101,46 @@ jobs: git config user.name "liquibot" git config user.email "liquibot@liquibase.org" + - name: Get Artifact ID + id: get-artifact-id + run: echo "artifact_id=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV + - name: Run extra command - if: inputs.extraCommand != '' + if: inputs.extraCommand run: | ${{ inputs.extraCommand }} + - name: Check and download artifacts from GPM + id: check-download-artifacts + env: + ARTIFACT_NAME: ${{ github.event.repository.name }} + run: | + RELEASE_VERSION=$(grep -m2 '' pom.xml | tail -n 1 | awk -F'[><]' '{print $3}' | sed 's/-SNAPSHOT//') + echo "RELEASE_VERSION=$RELEASE_VERSION" + mvn dependency:get -DgroupId=org.liquibase.ext -DartifactId=${{ env.ARTIFACT_NAME }} -Dversion=$RELEASE_VERSION -Dtransitive=false || echo "Failed to download artifact" + mvn dependency:get -DgroupId=org.liquibase.ext -DartifactId=${{ env.ARTIFACT_NAME }} -Dversion=$RELEASE_VERSION -Dpackaging=pom -Dtransitive=false || echo "Failed to download pom artifact" + mvn dependency:get -DgroupId=org.liquibase.ext -DartifactId=${{ env.ARTIFACT_NAME }} -Dversion=$RELEASE_VERSION -Dclassifier=sources -Dtransitive=false || echo "Failed to download sources artifact" + mvn dependency:get -DgroupId=org.liquibase.ext -DartifactId=${{ env.ARTIFACT_NAME }} -Dversion=$RELEASE_VERSION -Dclassifier=javadoc -Dtransitive=false || echo "Failed to download javadoc artifact" + rm -rf ~/.m2/repository/org/liquibase/ext/${{ env.ARTIFACT_NAME }}/$RELEASE_VERSION/*.lastUpdated + ARTIFACT_FOUND=$(ls -1 ~/.m2/repository/org/liquibase/ext/${{ env.ARTIFACT_NAME }}/$RELEASE_VERSION/ 2>/dev/null | wc -l) + echo "ARTIFACT_FOUND=$ARTIFACT_FOUND" >> $GITHUB_ENV + if [ $ARTIFACT_FOUND -eq 0 ]; then + echo "No artifact found" + else + echo "Artifact found" + rm -rf ./target && mkdir -p ./target + mv ~/.m2/repository/org/liquibase/ext/${{ env.ARTIFACT_NAME }}/$RELEASE_VERSION/* ./target + sed -i 's/-SNAPSHOT//g' pom.xml + fi + - name: Build release artifacts + if: env.ARTIFACT_FOUND == '0' id: build-release-artifacts run: | mvn -B release:clean release:prepare -Darguments="-Dusername=liquibot -Dpassword=$GITHUB_TOKEN -Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true -Dmaven.deploy.skip=true" -DreleaseVersion=${{ github.event.inputs.liquibaseVersion }} -DpushChanges=false -P '${{ inputs.mavenProfiles }}' git reset HEAD~ --hard mvn clean install -DskipTests -P '${{ inputs.mavenProfiles }}' - - name: Get Artifact ID - id: get-artifact-id - run: echo "artifact_id=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV - - name: Get latest draft release ID id: get-release run: |