Skip to content

Commit

Permalink
add-extra-command (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
jandroav authored Oct 20, 2023
1 parent c92bb0b commit 950c7c6
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/extension-attach-artifact-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand All @@ -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: |
Expand Down Expand Up @@ -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
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/extension-release-prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand All @@ -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 }}
17 changes: 15 additions & 2 deletions .github/workflows/extension-release-published.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -111,5 +122,7 @@ jobs:
maven-release:
needs: release
uses: liquibase/build-logic/.github/workflows/extension-release-prepare.yml@v0.5.1
secrets: inherit
uses: liquibase/build-logic/.github/workflows/extension-release-prepare.yml@v0.5.2
secrets: inherit
with:
extraCommand: ${{ inputs.extraCommand }}
11 changes: 11 additions & 0 deletions .github/workflows/extension-release-rollback.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/os-extension-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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 }}
8 changes: 4 additions & 4 deletions .github/workflows/package-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pom-release-published.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 18 additions & 1 deletion .github/workflows/pro-extension-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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 }}
11 changes: 11 additions & 0 deletions .github/workflows/sonar-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/sonar-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 950c7c6

Please sign in to comment.