Skip to content

Commit

Permalink
DAT-18141 changes for liquibase-checks extension (#229)
Browse files Browse the repository at this point in the history
* remove custom liquibase checks build.  Add ability to build on multiple OS if desired

* fix formatting

* use same os input for build and test jobs

* use same os input for build and test jobs

* fix typo

* 🔧 (.github/workflows/pro-extension-test.yml): Add Docker installation step for macOS runners to support Docker setup
♻️ (.github/workflows/pro-extension-test.yml): Refactor the way extraMavenArgs are passed to the Maven command to ensure proper handling of spaces and special characters

* 🔧 (pro-extension-test.yml): add support for 'combineJars' boolean input to specify if built jars should be combined into a single jar
🔧 (pro-extension-test.yml): create a new job 'Combine Jars' to download artifacts from different platforms and create a multiplatform jar if 'combineJars' input is true

* 🔧 (pro-extension-test.yml): remove unnecessary Docker installation steps for macOS
🔧 (pro-extension-test.yml): update conditional logic for running tests based on nightly flag and OS type to improve workflow efficiency

* 🔧 (.github/workflows/pro-extension-test.yml): Fix conditional statements for running tests to ensure correct logic
🔧 (.github/workflows/pro-extension-test.yml): Add ls command to list files in /tmp directory for debugging purposes

* 🔧 (.github/workflows/pro-extension-test.yml): Add new input 'modulePath' to specify the path to the module that should be built. This is useful for multi-module extensions.
🔧 (.github/workflows/pro-extension-test.yml): Update working directory for various steps to use the 'modulePath' input value.

* 🔧 (.github/workflows/pro-extension-test.yml): fix quotes around inputs.extraMavenArgs to prevent shell expansion and ensure correct arguments are passed to Maven commands

* 🔧 (pro-extension-test.yml): remove unnecessary 'unit-test' job dependency from 'combineJars' job to improve workflow efficiency

* ✨ (pro-extension-test.yml): refactor workflow to dynamically get and use project version for artifact naming and handling

* 📝 (pro-extension-test.yml): capitalize the first letter of the job names for consistency and readability
🔧 (pro-extension-test.yml): add quotes around the expression in the maven command to handle cases where the expression contains special characters

* 🐛 (.github/workflows/pro-extension-test.yml): fix syntax error in maven command by adding missing closing parenthesis

* 🔧 (.github/workflows/pro-extension-test.yml): update ls command to list files in /tmp directory for debugging purposes

* 📝 (pro-extension-test.yml): rename step to get artifact version and update references to use the correct output variable
🔧 (pro-extension-test.yml): update artifact naming to include the correct artifact version for consistency and clarity
🔧 (pro-extension-test.yml): update download paths to use the correct artifact version for each platform
🔧 (pro-extension-test.yml): refactor creating multiplatform jar to use a more concise and efficient method

* 🔧 (pro-extension-test.yml): remove duplicate step to get artifacts version to avoid redundancy and improve workflow efficiency

* 🐛 (.github/workflows/pro-extension-test.yml): fix typo in output variable name to correctly reference artifact version in workflow steps

* 🔧 (pro-extension-test.yml): remove redundant working-directory declarations to simplify workflow steps
🔧 (pro-extension-test.yml): separate download artifacts steps for Ubuntu, macOS, and Windows to improve clarity and organization
🔧 (pro-extension-test.yml): refactor artifact handling to create separate directories for Linux, Windows, and macOS artifacts and generate a combined artifact for liquibase checks

* 🔧 (pro-extension-test.yml): remove unnecessary jar creation and copying steps and update directory creation and extraction steps to improve workflow efficiency

* 🔧 (pro-extension-test.yml): fix incorrect flag usage in 'rm' command to remove directories
🔧 (pro-extension-test.yml): fix incorrect directory name in 'rm' command to remove liquibase-checks
🔧 (pro-extension-test.yml): fix incorrect file path in 'cat' command to combine fileslist.txt
🔧 (pro-extension-test.yml): fix incorrect directory name in 'zip' command to create liquibase-checks jar

* 🐛 (.github/workflows/pro-extension-test.yml): fix incorrect paths for liquibase-checks directory and files to ensure proper file operations and artifact creation.

* 🔧 (.github/workflows/pro-extension-test.yml): Change directory paths to use /tmp folder for creating multiplatform jar to avoid conflicts with existing files and improve organization.

* 🔧 (.github/workflows/pro-extension-test.yml): add debug commands to list contents of /tmp directory for troubleshooting purposes

* 🔧 (.github/workflows/extension-attach-artifact-release.yml): add combineJars option to specify combining jars into one for artifact release workflow
🔧 (.github/workflows/pro-extension-test.yml): remove redundant working-directory settings in job steps to improve workflow readability
🔧 (.github/workflows/pro-extension-test.yml): update paths to combine artifacts based on the operating system for better organization and clarity

* 🔧 (.github/workflows/pro-extension-test.yml): remove unused modulePath input and update artifactPath to include target directory for artifacts gathering. Update working-directory for Get Artifact ID and Get Artifact Version steps to use artifactPath instead of modulePath. Update path for Save Artifacts step to include target directory. Update path for Save Event File and Save Multiplatform Artifacts steps to include all files in the specified artifactPath.

* 📝 (.github/workflows/extension-attach-artifact-release.yml): add new input fields for os, extraMavenArgs, and artifactPath to provide more flexibility and customization options for the workflow.

* 🔧 (extension-attach-artifact-release.yml): Update file to use 'macos' instead of 'mac' for consistency
🔧 (pro-extension-test.yml): Update file to use 'macos' instead of 'mac' for consistency

* 🔧 (.github/workflows/extension-attach-artifact-release.yml): configure Git user name and email for actions to be performed by 'liquibot'
♻️ (.github/workflows/extension-attach-artifact-release.yml): refactor the build and package step to include release preparation and clean up
✨ (.github/workflows/extension-attach-artifact-release.yml): add support for downloading multiarchitecture release artifacts if combining jars
🔧 (.github/workflows/pro-extension-test.yml): update path for multiplatform artifacts to be consistent with changes in extension-attach-artifact-release.yml

* 🐛 (extension-attach-artifact-release.yml): update artifact path to include all files in /tmp/combined directory instead of specific versioned directory

* 🔧 (extension-attach-artifact-release.yml): Fix artifact naming issue in zip command to include correct version number
🔧 (extension-attach-artifact-release.yml): Update artifact path to only include the specific jar file
🔧 (pro-extension-test.yml): Fix artifact naming issue in zip command to include correct version number
🔧 (pro-extension-test.yml): Update artifact path to only include the specific jar file
🔧 (sonar-pull-request.yml): Add ability to specify the path to the artifacts to be attached to the build for multi-module extensions

* ⬆️ (pro-extension-test.yml): upgrade sonar-pull-request.yml workflow to version DAT-18141 to include specific changes and improvements for SonarQube integration.

* 🔧 (extension-attach-artifact-release.yml): Refactor artifact creation and upload process to use a more consistent naming convention and improve file organization
🔧 (pro-extension-test.yml): Refactor artifact creation and upload process to use a more consistent naming convention and improve file organization

* ✨ (extension-attach-artifact-release.yml): add dependency on combineJars job to ensure it runs before attaching artifact to release

* 🔧 (extension-attach-artifact-release.yml): change working directory to the specified artifact path before running the build and package step

* 🐛 (extension-attach-artifact-release.yml): fix issue with release build command by adding checkModificationExcludeList parameter to prevent unnecessary changes during release preparation.

* 🐛 (.github/workflows/pro-extension-test.yml): fix file paths for macOS directory to match the correct naming convention

* 🐛 (extension-attach-artifact-release.yml): fix issue with Maven command by adding ignoreSnapshots=true flag to prevent snapshot dependencies from being released

* 🔧 (.github/workflows/extension-attach-artifact-release.yml): update artifact references to use needs.build-multi-architecture outputs for multi-architecture support and improve artifact naming consistency. Add additional artifact files to be uploaded for the multiplatform artifact.

* 🔧 (extension-attach-artifact-release.yml): change 'mac' directory to 'macos' for consistency with other platforms.

* ⬆️ (extension-attach-artifact-release.yml): Upgrade setup-maven action to version 5 and maven-settings-xml-action to version 22 for better compatibility and features
⬆️ (pro-extension-test.yml): Upgrade setup-maven action to version 5 and maven-settings-xml-action to version 22 for better compatibility and features

* 🚀 (extension-attach-artifact-release.yml): reorganize zip command to correctly include all files in the jar archive

* 📝 (extension-attach-artifact-release.yml): simplify artifact path configuration to include all files in /tmp/combined directory for attachment to release

* 🔧 (pro-extension-test.yml): Update artifact copying logic to include sources, javadoc, and pom files in the combined directory for multiplatform artifacts upload.

* 📝 (extension-attach-artifact-release.yml): update artifact path to include separate jars for sources, javadoc, and pom files to be attached to the release.

* 📝 (pro-extension-test.yml): update artifact path to include sources, javadoc, and pom files for multiplatform artifacts in the build process.

* 🔧 (extension-release-published.yml): comment out the build release artifacts step to prevent unnecessary execution and speed up the workflow.

* 🔧 (extension-release-prepare.yml): Add support for specifying the path to artifacts for multi-module extensions
🔧 (extension-release-published.yml): Add support for specifying the path to artifacts for multi-module extensions
🔧 (extension-release-rollback.yml): Add support for specifying the path to artifacts for multi-module extensions

* 🔧 (extension-release-published.yml): update build-release-artifacts job to include working-directory for better organization and clarity
🔧 (extension-release-published.yml): update Get Artifact ID and Publish to Maven Central jobs to include working-directory for consistency and better organization

* 🔧 (.github/workflows/create-release.yml): Update the version of sonar-push.yml to DAT-18141 and add support for specifying the artifact path
🔧 (.github/workflows/sonar-push.yml): Add support for specifying the artifact path to be attached to the build

* 🔧 (extension-attach-artifact-release.yml): Update artifact path to include all files with the same prefix for better flexibility
🔧 (pro-extension-test.yml): Update artifact path to include all files with the same prefix for better flexibility

* 🔧 (extension-attach-artifact-release.yml): Update path to include all files in the specified directory
🔧 (pro-extension-test.yml): Update path to include all files in the specified directory

* 🔧 (extension-attach-artifact-release.yml): Update artifact path to include specific jar, sources jar, javadoc jar, and pom files for release attachment
🔧 (pro-extension-test.yml): Update artifact path to include specific jar, sources jar, javadoc jar, and pom files for testing purposes

* 🐛 (extension-attach-artifact-release.yml): Remove duplicate file path in artifact attachment step to prevent errors
🐛 (pro-extension-test.yml): Remove duplicate file path in artifact attachment step to prevent errors

* 🔧 (extension-attach-artifact-release.yml): remove unnecessary condition for combining jars during release artifact build to simplify workflow and improve clarity

* 🔧 (extension-attach-artifact-release.yml): set working directory to the specified artifact path before building release artifacts

* 🔧 (extension-attach-artifact-release.yml): Update file paths for artifact copying to simplify and improve readability
🔧 (pro-extension-test.yml): Update file paths for artifact copying to simplify and improve readability

* ✨ (pro-extension-test.yml): add dependency on unit-test job for combineJars job to ensure unit tests are run before combining jars

* 🔧 (extension-attach-artifact-release.yml): update mvn command to include checkModificationExcludeList and ignoreSnapshots options for release preparation.

* 🔧 (extension-attach-artifact-release.yml): comment out artifact download and build steps as they are not needed for the current workflow and can be re-enabled if required in the future.

* 🔧 (extension-attach-artifact-release.yml): Update workflow to check and download artifacts from GPM and build release artifacts
🔧 (extension-release-prepare.yml): Update workflow to prepare Maven release with correct arguments
🔧 (extension-release-published.yml): Update workflow to build release artifacts with correct arguments
🔧 (extension-release-rollback.yml): Update workflow to perform Maven release rollback with correct arguments

* 🔧 (extension-attach-artifact-release.yml): set working directory to the specified artifact path before signing files for draft release

* 🔧 (extension-attach-artifact-release.yml): set root directory variable to improve script readability and maintainability

* 🔧 (extension-release-prepare.yml): Add working directory configuration to run extra command in the specified path
🔧 (extension-release-published.yml): Add working directory configuration to run extra command in the specified path
🔧 (extension-release-rollback.yml): Add working directory configuration to run extra command in the specified path
🔧 (sonar-pull-request.yml): Add working directory configuration to run extra command in the specified path
🔧 (sonar-push.yml): Add working directory configuration to run extra command in the specified path

* 🔧 (extension-attach-artifact-release.yml): fix path to sign artifacts by using absolute path from REPO_ROOT to target directory

* 🔧 (extension-attach-artifact-release.yml): update path for artifact download to use the input variable for flexibility
🔧 (extension-attach-artifact-release.yml): update the working directory for attaching files to the draft release to the specified artifact path
🔧 (extension-attach-artifact-release.yml): update the command to run the upload script with the correct path to the project root folder

* 🔧 (extension-attach-artifact-release.yml): set working directory to the specified artifact path before setting draft release title

* 🔧 (extension-attach-artifact-release.yml): update artifact paths to include inputs.artifactPath for signing artifacts correctly

* 🔧 (extension-release-published.yml): use the provided input variable for the output file path instead of hardcoding it to improve flexibility and reusability

* ⬆️ (create-release.yml): Update sonar-push.yml reference to use the 'main' branch instead of a specific commit hash for better maintainability
⬆️ (extension-release-prepare.yml): Update extension-release-rollback.yml reference to use the 'main' branch instead of a specific commit hash for better maintainability
⬆️ (pro-extension-test.yml): Update sonar-pull-request.yml reference to use the 'main' branch instead of a specific commit hash for better maintainability

---------

Co-authored-by: Alejandro Alvarez <[email protected]>
Co-authored-by: Alejandro Alvarez <[email protected]>
  • Loading branch information
3 people authored Aug 9, 2024
1 parent c6a7a9a commit 7626777
Show file tree
Hide file tree
Showing 9 changed files with 368 additions and 26 deletions.
Binary file added .DS_Store
Binary file not shown.
8 changes: 7 additions & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ on:
required: false
default: ''
type: string
artifactPath:
description: "Specify the path to the artifacts that should be attached to the build. Useful for multi-module extensions."
required: false
default: "."
type: string

jobs:
sonar:
uses: liquibase/build-logic/.github/workflows/sonar-push.yml@v0.7.8
uses: liquibase/build-logic/.github/workflows/sonar-push.yml@main
secrets: inherit
with:
extraCommand: ${{ inputs.extraCommand }}
artifactPath: ${{ inputs.artifactPath }}

create-release:
name: Create Release
Expand Down
225 changes: 218 additions & 7 deletions .github/workflows/extension-attach-artifact-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@ on:
required: false
default: ""
type: string
os:
description: "Operating system to build/test on"
required: false
default: '["ubuntu-latest", "windows-latest"]'
type: string
extraMavenArgs:
description: "Specify it if you want to run an extra maven argument"
required: false
default: ""
type: string
artifactPath:
description: "Specify the path to the artifacts that should be attached to the build. Useful for multi-module extensions."
required: false
default: "."
type: string
combineJars:
description: 'Specify it if you want to combine jars into one'
required: false
default: false
type: boolean
secrets:
BOT_TOKEN:
description: 'BOT_TOKEN from the caller workflow'
Expand All @@ -30,8 +50,184 @@ on:
required: true

jobs:

build-multi-architecture:
strategy:
fail-fast: false
matrix:
os: ${{fromJson(inputs.os || '["ubuntu-latest"]')}}
name: Build & Package - ${{ matrix.os }}
if: ${{ inputs.combineJars }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "temurin"
cache: "maven"

- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: ${{ env.MAVEN_VERSION }}

# look for dependencies in maven
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v22
with:
repositories: |
[
{
"id": "liquibase",
"url": "https://maven.pkg.github.com/liquibase/liquibase",
"releases": {
"enabled": "true"
},
"snapshots": {
"enabled": "true",
"updatePolicy": "always"
}
},
{
"id": "liquibase-pro",
"url": "https://maven.pkg.github.com/liquibase/liquibase-pro",
"releases": {
"enabled": "true"
},
"snapshots": {
"enabled": "true",
"updatePolicy": "always"
}
}
]
servers: |
[
{
"id": "liquibase-pro",
"username": "liquibot",
"password": "${{ secrets.LIQUIBOT_PAT }}"
},
{
"id": "liquibase",
"username": "liquibot",
"password": "${{ secrets.LIQUIBOT_PAT }}"
}
]
- name: Configure Git
run: |
git config user.name "liquibot"
git config user.email "[email protected]"
- name: Run extra command
if: inputs.extraCommand != ''
run: |
${{ inputs.extraCommand }}
- name: Run extra Linux command
if: inputs.extraLinuxCommand != ''
run: |
${{ inputs.extraLinuxCommand }}
- name: Build and Package
working-directory: ${{ inputs.artifactPath }}
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" -DcheckModificationExcludeList=** -DignoreSnapshots=true -DreleaseVersion=${{ github.event.inputs.liquibaseVersion }} -DpushChanges=false -P '${{ inputs.mavenProfiles }}'
git reset HEAD~ --hard
mvn -B dependency:go-offline clean package -DskipTests=true ${{ inputs.extraMavenArgs }}
- name: Get Artifact ID
working-directory: ${{ inputs.artifactPath }}
id: get-artifact-id
run: echo "::set-output name=artifact_id::$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)"

- name: Get Artifact Version
working-directory: ${{ inputs.artifactPath }}
id: get-artifact-version
run: echo "::set-output name=artifact_version::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"

- name: Save Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ steps.get-artifact-id.outputs.artifact_id }}-${{ matrix.os }}-${{ steps.get-artifact-version.outputs.artifact_version }}-artifacts
path: |
${{ inputs.artifactPath }}/target/*
- name: Save Event File
uses: actions/upload-artifact@v3
with:
name: Event File
path: ${{ github.event_path }}
outputs:
artifact_id: ${{ steps.get-artifact-id.outputs.artifact_id }}
artifact_version: ${{ steps.get-artifact-version.outputs.artifact_version }}

combineJars:
needs: [ build-multi-architecture ]
if: ${{ inputs.combineJars }}
name: Combine Jars
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v4

- name: Download Ubuntu Artifacts
uses: actions/download-artifact@v2
with:
name: ${{needs.build-multi-architecture.outputs.artifact_id}}-ubuntu-latest-${{needs.build-multi-architecture.outputs.artifact_version}}-artifacts
path: /tmp/ubuntu

- name: Download macOS Artifacts
uses: actions/download-artifact@v2
with:
name: ${{needs.build-multi-architecture.outputs.artifact_id}}-macos-latest-${{needs.build-multi-architecture.outputs.artifact_version}}-artifacts
path: /tmp/macos

- name: Download Windows Artifacts
uses: actions/download-artifact@v2
with:
name: ${{needs.build-multi-architecture.outputs.artifact_id}}-windows-latest-${{needs.build-multi-architecture.outputs.artifact_version}}-artifacts
path: /tmp/windows

- name: Create multiplatform jar
run: |
rm -rf /tmp/combined/ubuntu /tmp/combined/windows /tmp/combined/macos
mkdir -p /tmp/combined/ubuntu /tmp/combined/windows /tmp/combined/macos
unzip -d /tmp/combined/ubuntu /tmp/ubuntu/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}.jar
unzip -d /tmp/combined/windows /tmp/windows/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}.jar
unzip -d /tmp/combined/macos /tmp/macos/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}.jar
rm -r -f /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}
mkdir /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}
cp -a /tmp/combined/ubuntu/* /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}/
cp -a /tmp/combined/windows/* /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}/
cp -a /tmp/combined/macos/* /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}/
rm /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}/vfs/fileslist.txt
cat /tmp/combined/ubuntu/vfs/fileslist.txt /tmp/combined/windows/vfs/fileslist.txt /tmp/combined/macos/vfs/fileslist.txt > /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}/vfs/fileslist.txt
rm -f /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}.jar
cd /tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}/
zip -r ../${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}.jar *
cd ..
cp /tmp/ubuntu/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}-sources.jar /tmp/combined/
cp /tmp/ubuntu/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}-javadoc.jar /tmp/combined/
cp /tmp/ubuntu/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}.pom /tmp/combined/
- name: Upload multiplatform artifact
uses: actions/upload-artifact@v3
with:
name: multiplatform-artifacts
path: |
/tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}.jar
/tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}-sources.jar
/tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}-javadoc.jar
/tmp/combined/${{needs.build-multi-architecture.outputs.artifact_id}}-${{needs.build-multi-architecture.outputs.artifact_version}}.pom
attach-to-release:
name: Attach Artifact to Release
needs: [ combineJars ]
runs-on: ubuntu-latest
steps:
- run: sleep 30
Expand All @@ -46,7 +242,7 @@ jobs:

# look for dependencies in maven
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v21
uses: whelk-io/maven-settings-xml-action@v22
with:
repositories: |
[
Expand Down Expand Up @@ -102,6 +298,7 @@ jobs:
git config user.email "[email protected]"
- name: Get Artifact ID
working-directory: ${{ inputs.artifactPath }}
id: get-artifact-id
run: echo "artifact_id=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV

Expand Down Expand Up @@ -134,13 +331,21 @@ jobs:
fi
- name: Build release artifacts
working-directory: ${{ inputs.artifactPath }}
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 }}'
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" -DcheckModificationExcludeList=** -DignoreSnapshots=true -DreleaseVersion=${{ github.event.inputs.liquibaseVersion }} -DpushChanges=false -P '${{ inputs.mavenProfiles }}'
git reset HEAD~ --hard
mvn clean install -DskipTests -P '${{ inputs.mavenProfiles }}'
- name: Download multiarchitecture release artifacts
if: inputs.combineJars
uses: actions/download-artifact@v2
with:
name: multiplatform-artifacts
path: ${{ inputs.artifactPath }}/target

- name: Get latest draft release ID
id: get-release
run: |
Expand Down Expand Up @@ -176,16 +381,21 @@ jobs:
gpg_private_key: ${{ secrets.GPG_SECRET }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: Set root directory variable
run: echo "REPO_ROOT=$(git rev-parse --show-toplevel)" >> $GITHUB_ENV

- name: Sign Files for Draft Release
working-directory: ${{ inputs.artifactPath }}
run: |
gpg -K
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
./.github/sign_artifact.sh ./target/${{ env.artifact_id }}-${version}.jar
./.github/sign_artifact.sh ./target/${{ env.artifact_id }}-${version}.pom
./.github/sign_artifact.sh ./target/${{ env.artifact_id }}-${version}-javadoc.jar
./.github/sign_artifact.sh ./target/${{ env.artifact_id }}-${version}-sources.jar
${{ env.REPO_ROOT }}/.github/sign_artifact.sh ${{ env.REPO_ROOT }}/${{ inputs.artifactPath }}/target/${{ env.artifact_id }}-${version}.jar
${{ env.REPO_ROOT }}/.github/sign_artifact.sh ${{ env.REPO_ROOT }}/${{ inputs.artifactPath }}/target/${{ env.artifact_id }}-${version}.pom
${{ env.REPO_ROOT }}/.github/sign_artifact.sh ${{ env.REPO_ROOT }}/${{ inputs.artifactPath }}/target/${{ env.artifact_id }}-${version}-javadoc.jar
${{ env.REPO_ROOT }}/.github/sign_artifact.sh ${{ env.REPO_ROOT }}/${{ inputs.artifactPath }}/target/${{ env.artifact_id }}-${version}-sources.jar
- name: Set draft release title
working-directory: ${{ inputs.artifactPath }}
id: set-release-title
run: |
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
Expand All @@ -194,8 +404,9 @@ jobs:
curl -X PATCH -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" -d '{"name": "'"$RELEASE_TITLE"'", "tag_name": "'"v$version"'"}' "https://api.github.com/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }}"
- name: Attach Files to Draft Release
working-directory: ${{ inputs.artifactPath }}
id: upload-release-asset
run: ./.github/upload_asset.sh $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
run: ${{ env.REPO_ROOT }}/.github/upload_asset.sh $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
ASSET_NAME_PREFIX: "${{ env.artifact_id }}-"
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/extension-release-prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
required: false
default: ''
type: string
artifactPath:
description: "Specify the path to the artifacts that should be attached to the build. Useful for multi-module extensions."
required: false
default: "."
type: string

permissions:
contents: write
Expand Down Expand Up @@ -84,11 +89,13 @@ jobs:
git config --local user.name "liquibot"
- name: Run extra command
working-directory: ${{ inputs.artifactPath }}
if: inputs.extraCommand != ''
run: |
${{ inputs.extraCommand }}
- name: Prepare Maven Release
working-directory: ${{ inputs.artifactPath }}
run: |
mvn -B build-helper:parse-version release:clean release:prepare \
-Darguments="-Dusername=liquibot -Dpassword=${{ secrets.BOT_TOKEN }} -Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true -Dmaven.deploy.skip=true" \
Expand All @@ -97,6 +104,7 @@ jobs:
git tag -d temp
git push --force
- name: Save Release files
if: always()
uses: actions/upload-artifact@v3
Expand All @@ -109,7 +117,8 @@ jobs:
release-rollback:
needs: prepare-release
if: ${{ always() && contains(needs.*.result, 'failure') }}
uses: liquibase/build-logic/.github/workflows/extension-release-rollback.yml@v0.7.8
uses: liquibase/build-logic/.github/workflows/extension-release-rollback.yml@main
secrets: inherit
with:
extraCommand: ${{ inputs.extraCommand }}
artifactPath: ${{ inputs.artifactPath }}
Loading

0 comments on commit 7626777

Please sign in to comment.