-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DAT-18303 DevOps :: Add Dry Run capabilities to extensions (#253)
* 🔧 (create-release.yml): Add support for dry-run flag and dry-run version in the workflow to create a dry-run release 🔧 (extension-attach-artifact-release.yml): Implement logic to build and package artifacts for a dry-run release if the dry-run flag is set to true ✨ (extension-dry-run.yml): Introduce a new workflow for executing a dry-run release, including creating a draft release, getting the draft release ID, and attaching artifacts to the dry-run release. * 🔧 (extension-attach-artifact-release.yml): change 'dryRun' to 'dry_run' for consistency and readability 🔧 (extension-dry-run.yml): change 'dryRun' to 'dry_run' for consistency and readability * 🔧 (create-release.yml): update step id from 'create-release' to 'create-dry-run-release' for clarity and consistency * 🔧 (extension-attach-artifact-release.yml): rename get-release to get-dry-run-release for clarity and consistency with dry-run process. * 🔧 (create-release.yml): add name and tag inputs to release-drafter action for better version control 🔧 (extension-dry-run.yml): add cleanup step to delete liquibase dry-run tag and the dry-run draft release for better maintenance and organization of the repository * 🔧 (create-release.yml): Remove dry_run and dry_run_version inputs as they are no longer needed 🔧 (extension-attach-artifact-release.yml): Remove dry_run_release_id input as it is no longer needed 🔧 (extension-dry-run.yml): Remove dry-run-create-release and dry-run-attach-artifact-to-release jobs as they are no longer needed 🔧 (extension-dry-run.yml): Remove cleanup job as it is no longer needed * ✨ (extension-attach-artifact-release.yml): Add support for dry-run mode to skip certain steps and use a different version for artifact building and signing in GitHub Actions workflow. * 🔧 (extension-attach-artifact-release.yml): add conditional check to only run sleep step if dry_run input is false * 🐛 (extension-dry-run.yml): fix dry_run_version and release_name values to use dots instead of hyphens for better readability and consistency. Update the git push command to delete the tag with the corrected format. * 🔧 (extension-dry-run.yml): Update dry_run_version to use github.run_number instead of github.run_id for better versioning 🔧 (extension-dry-run.yml): Update release_name to use v0.0.${{ github.run_number }} instead of vdry.run.${{ github.run_id }} 🔧 (extension-dry-run.yml): Update git push command to delete tag v0.0.${{ github.run_number }} instead of vdry.run.${{ github.run_id }} 🔧 (extension-dry-run.yml): Update SLACK_MESSAGE to include github.run_number instead of github.run_id for correct GitHub Actions URL viewing * 🔧 (extension-attach-artifact-release.yml): update files path to include all files in the target directory for attaching to draft release * 🔧 (extension-dry-run.yml): cleanup workflow file by removing commented out code and reformatting indentation for better readability. * ✨ (extension-attach-artifact-release.yml): Update release body to include "Dry Run" prefix for better clarity 🔧 (extension-dry-run.yml): Add support for running a dry run release with specific version and configuration 🔧 (extension-release-published.yml): Implement steps for publishing a dry run release to Maven Central Repository * 🔧 (extension-dry-run.yml): Remove extension-dry-run workflow file as it is no longer needed. * 🔧 (extension-release-published.yml): remove unnecessary 'needs: maven-release' from dry-run-release job configuration * 🔧 (extension-release-published.yml): update Sonatype Nexus staging repository URL to repo.liquibase.net for dry-run deployments * 📝 (extension-release-published.yml): update release downloader action to use releaseId instead of tag for downloading artifacts * 📝 (extension-release-published.yml): add dry_run_release_id input parameter to workflow for better customization and control over dry-run releases. * 🔧 (extension-attach-artifact-release.yml): add shell configuration to specify bash as the shell for the build and package job * 🔧 (extension-attach-artifact-release.yml): add shell configuration to specify bash as the shell for the script execution --------- Co-authored-by: Alejandro Alvarez <[email protected]>
- Loading branch information
Showing
2 changed files
with
203 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,19 @@ on: | |
required: false | ||
default: true | ||
type: boolean | ||
dry_run: | ||
description: 'Specify it if you want to run a dry run' | ||
required: false | ||
default: false | ||
type: boolean | ||
dry_run_version: | ||
description: 'The version of the dry-run release' | ||
required: false | ||
type: string | ||
dry_run_release_id: | ||
description: 'The release id of the dry-run release' | ||
required: false | ||
type: string | ||
secrets: | ||
SONATYPE_USERNAME: | ||
description: 'SONATYPE_USERNAME from the caller workflow' | ||
|
@@ -162,8 +175,115 @@ jobs: | |
-Dtypes=jar.asc,jar.asc,jar.asc,pom.asc \ | ||
-Dclassifiers=,sources,javadoc, | ||
dry-run-release: | ||
if: ${{ inputs.dry_run == true }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Java for publishing to Maven Central Repository | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: 'maven' | ||
|
||
# look for dependencies in maven | ||
- name: maven-settings-xml-action | ||
uses: whelk-io/maven-settings-xml-action@v21 | ||
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" | ||
} | ||
}, | ||
{ | ||
"id": "dry-run-sonatype-nexus-staging", | ||
"url": "https://repo.liquibase.net/repository/dry-run-sonatype-nexus-staging/", | ||
"releases": { | ||
"enabled": "true" | ||
}, | ||
"snapshots": { | ||
"enabled": "false" | ||
} | ||
} | ||
] | ||
servers: | | ||
[ | ||
{ | ||
"id": "liquibase-pro", | ||
"username": "liquibot", | ||
"password": "${{ secrets.LIQUIBOT_PAT }}" | ||
}, | ||
{ | ||
"id": "liquibase", | ||
"username": "liquibot", | ||
"password": "${{ secrets.LIQUIBOT_PAT }}" | ||
}, | ||
{ | ||
"id": "dry-run-sonatype-nexus-staging", | ||
"username": "${{ secrets.REPO_LIQUIBASE_NET_USER }}", | ||
"password": "${{ secrets.REPO_LIQUIBASE_NET_PASSWORD }}" | ||
} | ||
] | ||
- name: Configure Git | ||
run: | | ||
git config user.name "liquibot" | ||
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 | ||
|
||
- name: Download Release Artifacts | ||
uses: robinraju/[email protected] | ||
with: | ||
releaseId: "${{ inputs.dry_run_release_id }}" | ||
filename: "${{ env.artifact_id }}-*" | ||
out-file-path: ${{ inputs.artifactPath }} | ||
|
||
- name: Publish to Maven Central | ||
working-directory: ${{ inputs.artifactPath }} | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.REPO_LIQUIBASE_NET_USER }} | ||
MAVEN_PASSWORD: ${{ secrets.REPO_LIQUIBASE_NET_PASSWORD }} | ||
run: | | ||
version=${{ inputs.dry_run_version }} | ||
mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file \ | ||
-Durl=https://repo.liquibase.net/repository/dry-run-sonatype-nexus-staging/ \ | ||
-DrepositoryId=dry-run-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, | ||
deploy_xsd: | ||
if: inputs.nameSpace != '' && inputs.deployToMavenCentral == true | ||
if: inputs.nameSpace != '' && inputs.deployToMavenCentral == true && inputs.dry_run == false | ||
name: Upload xsds | ||
runs-on: ubuntu-20.04 | ||
# These permissions are needed to interact with GitHub's OIDC Token endpoint. | ||
|