-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
71d95e1
commit e21b4b8
Showing
9 changed files
with
438 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
set -o pipefail | ||
|
||
if [[ -z "$GITHUB_TOKEN" ]]; then | ||
echo "Set the GITHUB_TOKEN env variable." | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "$GITHUB_ISSUE_URL" ]]; then | ||
echo "Set the GITHUB_ISSUE_URL env variable." | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "$GITHUB_COMMENT" ]]; then | ||
echo "Set the GITHUB_COMMENT env variable." | ||
exit 1 | ||
fi | ||
|
||
data='{"body":"'${GITHUB_COMMENT}'"}' | ||
|
||
#Create Label on Pull Request | ||
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \ | ||
--data "$data" \ | ||
"$GITHUB_ISSUE_URL/comments" |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -o pipefail | ||
|
||
if [[ -z "$GITHUB_TOKEN" ]]; then | ||
echo "Set the GITHUB_TOKEN env variable." | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "$GITHUB_ISSUE_URL" ]]; then | ||
echo "Set the GITHUB_ISSUE_URL env variable." | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "$GITHUB_LABEL" ]]; then | ||
echo "Set the GITHUB_LABEL env variable." | ||
exit 1 | ||
fi | ||
|
||
data='["'${GITHUB_LABEL}'"]' | ||
|
||
#Create Label on Pull Request | ||
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \ | ||
--data "$data" \ | ||
"$GITHUB_ISSUE_URL/labels" |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -o pipefail | ||
|
||
HEAD_REF=$1 | ||
|
||
if [[ -z "$HEAD_REF" ]]; then | ||
echo "Set the HEAD_REF parameter" | ||
exit 1 | ||
fi | ||
|
||
echo "VERSION_TAG=${HEAD_REF#*org.liquibase-liquibase-core-}" >> $GITHUB_ENV |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -o pipefail | ||
|
||
echo "VERSION_TAG=$(mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV |
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 |
---|---|---|
@@ -0,0 +1,126 @@ | ||
name: Prepare Release Candidate for Release | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
build: | ||
name: Build Artifact | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'main'&& github.event.pull_request.merged && contains( github.event.pull_request.labels.*.name, 'Extension Release Candidate :rocket:' ) | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cache Local Maven Repository | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
server-id: sonatype-nexus-staging | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
gpg-private-key: ${{ secrets.GPG_SECRET }} | ||
gpg-passphrase: GPG_PASSPHRASE | ||
|
||
- name: Build With Maven | ||
run: mvn clean install -Dmaven.test.skip | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
|
||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: liquibase-cosmosdb | ||
path: target/*.jar | ||
|
||
draft-release: | ||
needs: [ build ] | ||
name: Draft Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cache Local Maven Repository | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
|
||
- name: Set Version Tag ENV from POM | ||
run: ./.github/set-version-from-pom.sh | ||
|
||
- run: echo ::set-output name=version::$VERSION_TAG | ||
id: version | ||
|
||
- name: Download Artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: liquibase-cosmosdb | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
target_commitish: ${{ github.sha }} | ||
name: v${{ steps.version.outputs.version }} | ||
tag_name: liquibase-cosmosdb-${{ steps.version.outputs.version }} | ||
draft: true | ||
body: Support for Liquibase ${{ steps.version.outputs.version }}. | ||
files: liquibase-cosmosdb-*.jar | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
bump-pom-to-snapshot: | ||
name: Prepare POM for Development | ||
runs-on: ubuntu-latest | ||
needs: [ draft-release ] | ||
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 failed to push refs to dest repo | ||
|
||
- name: Cache Local Maven Repository | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
|
||
- name: Configure git user | ||
run: | | ||
git config user.name "liquibot" | ||
git config user.email "[email protected]" | ||
- name: Bump POM Version for Development | ||
run: | | ||
mvn versions:set -DnextSnapshot=true | ||
git add pom.xml | ||
git commit -m "Version Bumped to Snapshot for Developent" | ||
git push "https://liquibot:[email protected]/$GITHUB_REPOSITORY.git" HEAD:${{ github.base_ref }} --follow-tags --tags | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Build, Test, and Prepare Release Candidate | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- labeled | ||
- reopened | ||
- synchronize | ||
|
||
jobs: | ||
integration-tests: | ||
name: Java ${{ matrix.java }} | ||
runs-on: ubuntu-latest | ||
if: contains( github.event.pull_request.labels.*.name, 'Extension Release Candidate :rocket:' ) | ||
strategy: | ||
matrix: | ||
java: [8, 11, 16] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cache Local Maven Repository | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Set up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
distribution: 'adopt' | ||
- name: Test With Maven | ||
run: mvn clean verify --file pom.xml |
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 |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: Run Unit Tests | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
|
||
jobs: | ||
unit-test: | ||
name: Java ${{ matrix.java }} | ||
runs-on: ubuntu-latest | ||
# Only run job if untagged as release. Will run for all PRs and release PRs during the first run. | ||
if: ${{ !contains( github.event.pull_request.labels.*.name, 'Extension Release Candidate :rocket:' ) }} | ||
strategy: | ||
matrix: | ||
java: [8, 11, 16] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cache Local Maven Repository | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Set up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
distribution: 'adopt' | ||
- name: Run Unit Tests With Maven | ||
run: mvn surefire:test --file pom.xml | ||
|
||
# This step is the automation to create a release based on a liquibase core bump | ||
# If a manual release is required, the steps below will need to be done manually prior | ||
# to adding the Release Candidate label. | ||
label: | ||
name: Label as Release Candidate | ||
runs-on: ubuntu-latest | ||
needs: [ unit-test ] | ||
if: contains( github.event.pull_request.head.ref, 'dependabot/maven/org.liquibase-liquibase-core' ) | ||
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 failed to push refs to dest repo | ||
|
||
- name: Cache Local Maven Repository | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
|
||
- name: Set Version Tag ENV | ||
run: ./.github/set-version-from-head.sh ${{ github.event.pull_request.head.ref }} | ||
|
||
- run: echo $VERSION_TAG | ||
|
||
- name: Configure git user | ||
run: | | ||
git config user.name "liquibot" | ||
git config user.email "[email protected]" | ||
- name: Bump POM Version for Next Release | ||
run: | | ||
mvn versions:set -DnewVersion=$VERSION_TAG | ||
git add pom.xml | ||
git commit -m "Version Bumped to $VERSION_TAG" | ||
git tag -a -m "Version Bumped to $VERSION_TAG" liquibase-cosmosdb-$VERSION_TAG | ||
git push "https://liquibot:[email protected]/$GITHUB_REPOSITORY.git" HEAD:${{ github.event.pull_request.head.ref }} --follow-tags --tags | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | ||
|
||
- run: ./.github/add-label-to-pull-request.sh | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | ||
GITHUB_ISSUE_URL: ${{ github.event.pull_request._links.issue.href }} | ||
GITHUB_LABEL: "Extension Release Candidate :rocket:" | ||
- run: ./.github/add-comment-to-pull-request.sh | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | ||
GITHUB_ISSUE_URL: ${{ github.event.pull_request._links.issue.href }} | ||
GITHUB_COMMENT: "<h2> ⚠️ Reminder</h2>Release Candidate pull requests will automatically release when merged.<br /><br />Please review and merge all other pull requests prior to merging this request." |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Release Extension to Sonatype | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Java for publishing to Maven Central Repository | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
server-id: sonatype-nexus-staging | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
gpg-private-key: ${{ secrets.GPG_SECRET }} | ||
gpg-passphrase: GPG_PASSPHRASE | ||
|
||
- name: Publish to the Maven Central Repository | ||
run: mvn clean deploy -Dmaven.test.skip -P release | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
Oops, something went wrong.