liquibase-release #33
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
name: Create Release | |
on: | |
repository_dispatch: | |
types: [liquibase-release] | |
workflow_dispatch: | |
inputs: | |
liquibaseVersion: | |
description: 'Liquibase Version' | |
required: true | |
extensionVersion: | |
description: 'Extension Version (Defaults to Liquibase Version)' | |
required: false | |
jobs: | |
setup: | |
name: Setup | |
runs-on: ubuntu-latest | |
outputs: | |
liquibaseVersion: ${{ steps.collect-data.outputs.liquibaseVersion }} | |
extensionVersion: ${{ steps.collect-data.outputs.extensionVersion }} | |
steps: | |
- name: Collect Data | |
id: collect-data | |
uses: actions/github-script@v4 | |
with: | |
script: | | |
if (context.payload.client_payload) { | |
core.setOutput("liquibaseVersion", context.payload.client_payload.liquibaseVersion); | |
core.setOutput("extensionVersion", context.payload.client_payload.liquibaseVersion); | |
} else if (context.payload.inputs) { | |
core.setOutput("liquibaseVersion", context.payload.inputs.liquibaseVersion); | |
core.setOutput("extensionVersion", context.payload.inputs.extensionVersion || context.payload.inputs.liquibaseVersion); | |
} else { | |
core.setFailed('Unknown event type') | |
} | |
- run: | | |
echo "Saw Liquibase version ${{ steps.collect-data.outputs.liquibaseVersion }}" | |
echo "Saw Extension version ${{ steps.collect-data.outputs.extensionVersion }}" | |
create-release-artifacts: | |
name: "Create release artifacts" | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo | |
- name: Set up JDK | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'maven' | |
gpg-private-key: ${{ secrets.GPG_SECRET }} | |
gpg-passphrase: GPG_PASSPHRASE | |
env: | |
GPG_PASSWORD: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Download snapshot build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: mvn -B liquibase-sdk:download-snapshot-artifacts -Dliquibase.sdk.repo=${{ github.repository }} -Dliquibase.sdk.branchSearch=master -Dliquibase.sdk.artifactPattern=liquibase-maxdb-artifacts -Dliquibase.sdk.downloadDirectory=original-artifacts | |
- name: Re-version Artifacts | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GPG_PASSWORD: ${{ secrets.GPG_PASSPHRASE }} | |
run: | | |
(cd original-artifacts && unzip liquibase-maxdb-artifacts.zip && rm liquibase-maxdb-artifacts.zip) | |
mvn -B liquibase-sdk:create-release-artifacts -Dliquibase.sdk.repo=${{ github.repository }} -Dliquibase.sdk.inputDirectory=original-artifacts -Dliquibase.sdk.outputDirectory=final-artifacts -Dliquibase.sdk.newVersion=${{ needs.setup.outputs.extensionVersion }} -Dliquibase.sdk.gpgExecutable=/usr/bin/gpg -X | |
- name: Attach Files to Draft Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: v${{ needs.setup.outputs.extensionVersion }} | |
draft: true | |
fail_on_unmatched_files: true | |
body: Support for Liquibase ${{ needs.setup.outputs.liquibaseVersion }}. | |
generate_release_notes: true | |
files: final-artifacts/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |