Skip to content

Commit

Permalink
Merge pull request #48 from liquibase/DAT-15578
Browse files Browse the repository at this point in the history
DAT-15578 Change maven release perform on extensions build-logic
  • Loading branch information
jandroav authored Aug 2, 2023
2 parents c758626 + 677e8cb commit 0d13772
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 28 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ name: Create Release
on:
workflow_call:

permissions:
contents: write
pull-requests: write

jobs:
sonar:
uses: liquibase/build-logic/.github/workflows/[email protected].4
uses: liquibase/build-logic/.github/workflows/[email protected].5
secrets: inherit

create-release:
Expand Down
27 changes: 13 additions & 14 deletions .github/workflows/extension-attach-artifact-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ on:

jobs:

release-prepare:
uses: liquibase/build-logic/.github/workflows/[email protected]
secrets: inherit

attach-to-release:
name: Attach Artifact to Release
if: github.event.pull_request.merged == true
Expand All @@ -36,26 +32,29 @@ jobs:

- name: Get Reusable Script Files
run: |
curl -o $PWD/.github/get_draft_release.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.4/.github/get_draft_release.sh
curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.4/.github/sign_artifact.sh
curl -o $PWD/.github/upload_asset.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.4/.github/upload_asset.sh
curl -o $PWD/.github/get_draft_release.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.5/.github/get_draft_release.sh
curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.5/.github/sign_artifact.sh
curl -o $PWD/.github/upload_asset.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.5/.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
- name: Update branch with latest commits # needed for getting the latest pom.xml generated by release-prepare step
- name: Configure Git
run: |
git config user.name "liquibot"
git config user.email "[email protected]"
- name: Build release artifacts
id: build-release-artifacts
run: |
git pull origin ${{ env.GITHUB_REF_NAME }}
git checkout HEAD~1
mvn -B release:clean release:prepare -Dusername=liquibot -Dpassword=$GITHUB_TOKEN -Darguments="-Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true -Dmaven.deploy.skip=true" -DreleaseVersion=${{ github.event.inputs.liquibaseVersion }} -DpushChanges=false
git reset HEAD~ --hard
mvn clean install -DskipTests
- name: Get Artifact ID
id: get-artifact-id
run: echo "artifact_id=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV

- name: Build release artifacts
id: build-release-artifacts
run: mvn clean install -DskipTests

- name: Get Release Tag
id: get-release-tag
run: echo "release_tag=$(./.github/get_draft_release.sh TAG)" >> $GITHUB_ENV
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/extension-release-prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: main

- name: Set up JDK
uses: actions/setup-java@v2
Expand Down
42 changes: 31 additions & 11 deletions .github/workflows/extension-release-published.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,38 @@ on:
SONATYPE_TOKEN:
description: 'SONATYPE_TOKEN from the caller workflow'
required: true

permissions:
contents: write
pull-requests: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: sonatype-nexus-staging
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: Configure Git
run: |
git config user.name "liquibot"
git config user.email "[email protected]"
- name: Build release artifacts
id: build-release-artifacts
run: |
mvn -B release:clean release:prepare -Dusername=liquibot -Dpassword=$GITHUB_TOKEN -Darguments="-Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true -Dmaven.deploy.skip=true" -DreleaseVersion=${{ github.event.inputs.liquibaseVersion }} -DpushChanges=false
git reset HEAD~ --hard
- name: Get Artifact ID
id: get-artifact-id
run: echo "artifact_id=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV
Expand All @@ -27,16 +52,6 @@ jobs:
filename: "${{ env.artifact_id }}-*"
out-file-path: "."

- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: sonatype-nexus-staging
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: Publish to Maven Central
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
Expand All @@ -53,4 +68,9 @@ jobs:
-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,
-Dclassifiers=,sources,javadoc,
release-prepare:
needs: release
uses: liquibase/build-logic/.github/workflows/[email protected]
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/os-extension-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ jobs:
sonar-pr:
needs: [ unit-test ]
uses: liquibase/build-logic/.github/workflows/[email protected].4
uses: liquibase/build-logic/.github/workflows/[email protected].5
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/pro-extension-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,5 @@ jobs:
sonar-pr:
needs: [ unit-test ]
uses: liquibase/build-logic/.github/workflows/[email protected].4
uses: liquibase/build-logic/.github/workflows/[email protected].5
secrets: inherit

0 comments on commit 0d13772

Please sign in to comment.