From 950c7c601616ead551d1e535f7966a6f6e22819e Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Date: Fri, 20 Oct 2023 10:22:01 +0200 Subject: [PATCH] add-extra-command (#104) --- .github/workflows/create-release.yml | 2 +- .../extension-attach-artifact-release.yml | 18 ++++++++++++++---- .../workflows/extension-release-prepare.yml | 15 ++++++++++++++- .../workflows/extension-release-published.yml | 17 +++++++++++++++-- .../workflows/extension-release-rollback.yml | 11 +++++++++++ .github/workflows/os-extension-test.yml | 19 ++++++++++++++++++- .github/workflows/package-deb.yml | 8 ++++---- .github/workflows/pom-release-published.yml | 2 +- .github/workflows/pro-extension-test.yml | 19 ++++++++++++++++++- .github/workflows/sonar-pull-request.yml | 11 +++++++++++ .github/workflows/sonar-push.yml | 11 +++++++++++ 11 files changed, 118 insertions(+), 15 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 63d6b969..dfe28c1a 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -5,7 +5,7 @@ on: jobs: sonar: - uses: liquibase/build-logic/.github/workflows/sonar-push.yml@v0.5.1 + uses: liquibase/build-logic/.github/workflows/sonar-push.yml@v0.5.2 secrets: inherit create-release: diff --git a/.github/workflows/extension-attach-artifact-release.yml b/.github/workflows/extension-attach-artifact-release.yml index 19b468cc..f9b50b7f 100644 --- a/.github/workflows/extension-attach-artifact-release.yml +++ b/.github/workflows/extension-attach-artifact-release.yml @@ -8,6 +8,11 @@ on: required: false default: 'false' type: string + extraCommand: + description: 'Specify it if you want to run an extra command before attaching the artifact' + required: false + default: '' + type: string secrets: BOT_TOKEN: description: 'BOT_TOKEN from the caller workflow' @@ -80,9 +85,9 @@ jobs: - name: Get Reusable Script Files run: | - curl -o $PWD/.github/get_draft_release.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.5.1/.github/get_draft_release.sh - curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.5.1/.github/sign_artifact.sh - curl -o $PWD/.github/upload_asset.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.5.1/.github/upload_asset.sh + curl -o $PWD/.github/get_draft_release.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.5.2/.github/get_draft_release.sh + curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.5.2/.github/sign_artifact.sh + curl -o $PWD/.github/upload_asset.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.5.2/.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 @@ -92,6 +97,11 @@ jobs: git config user.name "liquibot" git config user.email "liquibot@liquibase.org" + - name: Run extra command + if: inputs.extraCommand != '' + run: | + ${{ inputs.extraCommand }} + - name: Build release artifacts id: build-release-artifacts run: | @@ -158,7 +168,7 @@ jobs: - name: Get upload_zip.sh Script File if: inputs.zip == 'true' run: | - curl -o $PWD/.github/upload_zip.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.5.1/.github/upload_zip.sh + curl -o $PWD/.github/upload_zip.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.5.2/.github/upload_zip.sh chmod +x $PWD/.github/upload_zip.sh - name: Attach Zip File to Draft Release diff --git a/.github/workflows/extension-release-prepare.yml b/.github/workflows/extension-release-prepare.yml index 613f2bf2..8a03d2e0 100644 --- a/.github/workflows/extension-release-prepare.yml +++ b/.github/workflows/extension-release-prepare.yml @@ -2,6 +2,12 @@ name: Prepare release on: workflow_call: + inputs: + extraCommand: + description: 'Specify it if you want to run an extra command before attaching the artifact' + required: false + default: '' + type: string permissions: contents: write @@ -75,6 +81,11 @@ jobs: git config user.name "liquibot" git config user.email "liquibot@liquibase.org" + - name: Run extra command + if: inputs.extraCommand != '' + run: | + ${{ inputs.extraCommand }} + - name: Prepare Maven Release run: | mvn -B build-helper:parse-version release:clean release:prepare \ @@ -95,5 +106,7 @@ jobs: release-rollback: needs: prepare-release if: ${{ always() && contains(needs.*.result, 'failure') }} - uses: liquibase/build-logic/.github/workflows/extension-release-rollback.yml@v0.5.1 + uses: liquibase/build-logic/.github/workflows/extension-release-rollback.yml@v0.5.2 secrets: inherit + with: + extraCommand: ${{ inputs.extraCommand }} diff --git a/.github/workflows/extension-release-published.yml b/.github/workflows/extension-release-published.yml index 5494d9b3..96f347b8 100644 --- a/.github/workflows/extension-release-published.yml +++ b/.github/workflows/extension-release-published.yml @@ -2,6 +2,12 @@ name: Release Extension to Sonatype on: workflow_call: + inputs: + extraCommand: + description: 'Specify it if you want to run an extra command before attaching the artifact' + required: false + default: '' + type: string secrets: SONATYPE_USERNAME: description: 'SONATYPE_USERNAME from the caller workflow' @@ -74,6 +80,11 @@ jobs: git config user.name "liquibot" git config user.email "liquibot@liquibase.org" + - name: Run extra command + if: inputs.extraCommand != '' + run: | + ${{ inputs.extraCommand }} + - name: Build release artifacts id: build-release-artifacts run: | @@ -111,5 +122,7 @@ jobs: maven-release: needs: release - uses: liquibase/build-logic/.github/workflows/extension-release-prepare.yml@v0.5.1 - secrets: inherit \ No newline at end of file + uses: liquibase/build-logic/.github/workflows/extension-release-prepare.yml@v0.5.2 + secrets: inherit + with: + extraCommand: ${{ inputs.extraCommand }} \ No newline at end of file diff --git a/.github/workflows/extension-release-rollback.yml b/.github/workflows/extension-release-rollback.yml index d41a2002..4d4887d9 100644 --- a/.github/workflows/extension-release-rollback.yml +++ b/.github/workflows/extension-release-rollback.yml @@ -2,6 +2,12 @@ name: Release rollback on: workflow_call: + inputs: + extraCommand: + description: 'Specify it if you want to run an extra command before attaching the artifact' + required: false + default: '' + type: string permissions: contents: write @@ -81,6 +87,11 @@ jobs: with: name: release-files + - name: Run extra command + if: inputs.extraCommand != '' + run: | + ${{ inputs.extraCommand }} + - name: Perform Maven Release Rollback run: | mvn -B versions:revert release:rollback \ diff --git a/.github/workflows/os-extension-test.yml b/.github/workflows/os-extension-test.yml index b29d3afc..f83cdbdb 100644 --- a/.github/workflows/os-extension-test.yml +++ b/.github/workflows/os-extension-test.yml @@ -18,6 +18,11 @@ on: required: false default: false type: boolean + extraCommand: + description: 'Specify it if you want to run an extra command before attaching the artifact' + required: false + default: '' + type: string env: MAVEN_VERSION: '3.9.5' @@ -84,6 +89,11 @@ jobs: } ] + - name: Run extra command + if: inputs.extraCommand != '' + run: | + ${{ inputs.extraCommand }} + - name: Build and Package latest liquibase version if: ${{ inputs.nightly }} run: mvn -B dependency:go-offline clean package -DskipTests=true -Dliquibase.version=master-SNAPSHOT @@ -144,6 +154,11 @@ jobs: name: ${{needs.build.outputs.artifact_id}}-artifacts path: ./target + - name: Run extra command + if: inputs.extraCommand != '' + run: | + ${{ inputs.extraCommand }} + - name: Run Tests run: mvn -B jacoco:prepare-agent surefire:test @@ -158,5 +173,7 @@ jobs: sonar-pr: needs: [ unit-test ] - uses: liquibase/build-logic/.github/workflows/sonar-pull-request.yml@v0.5.1 + uses: liquibase/build-logic/.github/workflows/sonar-pull-request.yml@v0.5.2 secrets: inherit + with: + extraCommand: ${{ inputs.extraCommand }} diff --git a/.github/workflows/package-deb.yml b/.github/workflows/package-deb.yml index b80a3dfc..d1ae832f 100644 --- a/.github/workflows/package-deb.yml +++ b/.github/workflows/package-deb.yml @@ -54,10 +54,10 @@ jobs: # Under the src folder is where specific packages files live. The GitHub action inputs will modify the universal package-deb-pom.xml to tell the process which assets to use during the packaging step mkdir -p $PWD/.github/src/${{ inputs.artifactId }}/deb/control mkdir -p $PWD/.github/src/${{ inputs.artifactId }}/main/archive - curl -o $PWD/.github/src/${{ inputs.artifactId }}/deb/control/control https://raw.githubusercontent.com/liquibase/build-logic/v0.5.1/src/${{ inputs.artifactId }}/deb/control/control - curl -o $PWD/.github/src/${{ inputs.artifactId }}/deb/control/postinst https://raw.githubusercontent.com/liquibase/build-logic/v0.5.1/src/${{ inputs.artifactId }}/deb/control/postinst - curl -o $PWD/.github/src/${{ inputs.artifactId }}/main/archive/${{ inputs.artifactId }}-env.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.5.1/src/${{ inputs.artifactId }}/main/archive/${{ inputs.artifactId }}-env.sh - curl -o $PWD/.github/package-deb-pom.xml https://raw.githubusercontent.com/liquibase/build-logic/v0.5.1/.github/package-deb-pom.xml + curl -o $PWD/.github/src/${{ inputs.artifactId }}/deb/control/control https://raw.githubusercontent.com/liquibase/build-logic/v0.5.2/src/${{ inputs.artifactId }}/deb/control/control + curl -o $PWD/.github/src/${{ inputs.artifactId }}/deb/control/postinst https://raw.githubusercontent.com/liquibase/build-logic/v0.5.2/src/${{ inputs.artifactId }}/deb/control/postinst + curl -o $PWD/.github/src/${{ inputs.artifactId }}/main/archive/${{ inputs.artifactId }}-env.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.5.2/src/${{ inputs.artifactId }}/main/archive/${{ inputs.artifactId }}-env.sh + curl -o $PWD/.github/package-deb-pom.xml https://raw.githubusercontent.com/liquibase/build-logic/v0.5.2/.github/package-deb-pom.xml - name: Set up Maven uses: stCarolas/setup-maven@v4.5 diff --git a/.github/workflows/pom-release-published.yml b/.github/workflows/pom-release-published.yml index 95f4e164..0746f190 100644 --- a/.github/workflows/pom-release-published.yml +++ b/.github/workflows/pom-release-published.yml @@ -68,5 +68,5 @@ jobs: maven-release: needs: release - uses: liquibase/build-logic/.github/workflows/extension-release-prepare.yml@v0.5.1 + uses: liquibase/build-logic/.github/workflows/extension-release-prepare.yml@v0.5.2 secrets: inherit \ No newline at end of file diff --git a/.github/workflows/pro-extension-test.yml b/.github/workflows/pro-extension-test.yml index 656fd91f..095b0e94 100644 --- a/.github/workflows/pro-extension-test.yml +++ b/.github/workflows/pro-extension-test.yml @@ -18,6 +18,11 @@ on: required: false default: false type: boolean + extraCommand: + description: 'Specify it if you want to run an extra command before attaching the artifact' + required: false + default: '' + type: string secrets: SONAR_TOKEN: description: 'SONAR_TOKEN from the caller workflow' @@ -102,6 +107,11 @@ jobs: } ] + - name: Run extra command + if: inputs.extraCommand != '' + run: | + ${{ inputs.extraCommand }} + - name: Build and Package latest liquibase version if: ${{ inputs.nightly }} run: mvn -B dependency:go-offline clean package -DskipTests=true -Dliquibase.version=master-SNAPSHOT @@ -202,6 +212,11 @@ jobs: name: ${{needs.build.outputs.artifact_id}}-artifacts path: ./target + - name: Run extra command + if: inputs.extraCommand != '' + run: | + ${{ inputs.extraCommand }} + - name: Run Tests run: mvn -B jacoco:prepare-agent surefire:test @@ -216,5 +231,7 @@ jobs: sonar-pr: needs: [ unit-test ] - uses: liquibase/build-logic/.github/workflows/sonar-pull-request.yml@v0.5.1 + uses: liquibase/build-logic/.github/workflows/sonar-pull-request.yml@v0.5.2 secrets: inherit + with: + extraCommand: ${{ inputs.extraCommand }} diff --git a/.github/workflows/sonar-pull-request.yml b/.github/workflows/sonar-pull-request.yml index 2792c077..5661a50a 100644 --- a/.github/workflows/sonar-pull-request.yml +++ b/.github/workflows/sonar-pull-request.yml @@ -2,6 +2,12 @@ name: Sonar Scan for Pull Requests on: workflow_call: + inputs: + extraCommand: + description: 'Specify it if you want to run an extra command before attaching the artifact' + required: false + default: '' + type: string secrets: SONAR_TOKEN: description: 'SONAR_TOKEN from the caller workflow' @@ -79,6 +85,11 @@ jobs: key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar + - name: Run extra command + if: inputs.extraCommand != '' + run: | + ${{ inputs.extraCommand }} + - name: Get Artifact ID id: get-artifact-id run: echo "artifact_id=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV diff --git a/.github/workflows/sonar-push.yml b/.github/workflows/sonar-push.yml index 87d14c4d..2fd40f9e 100644 --- a/.github/workflows/sonar-push.yml +++ b/.github/workflows/sonar-push.yml @@ -2,6 +2,12 @@ name: Sonar Scan for Pushes on: workflow_call: + inputs: + extraCommand: + description: 'Specify it if you want to run an extra command before attaching the artifact' + required: false + default: '' + type: string secrets: SONAR_TOKEN: description: 'SONAR_TOKEN from the caller workflow' @@ -37,6 +43,11 @@ jobs: key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar + - name: Run extra command + if: inputs.extraCommand != '' + run: | + ${{ inputs.extraCommand }} + - name: Get Artifact ID id: get-artifact-id run: echo "artifact_id=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV