-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to release on Maven Central
This commit adds a standard GHA workflow to perform a release, including syncing with Maven Central using s01.oss.sonatype.org. The release workflow kicks off based on tag that matches `vX.Y.Z` and perform the following: * Build the project * Stage the bits to repo.spring.io * Move the staging bits to Maven Central * Promote the bits to repo.spring.io/release * Generate a changelog using the issues matching the version Closes gh-1812
- Loading branch information
Showing
6 changed files
with
217 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,20 @@ | ||
name: Await HTTP Resource | ||
description: 'Waits for an HTTP resource to be available (a HEAD request succeeds)' | ||
inputs: | ||
url: | ||
description: 'URL of the resource to await' | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Await HTTP resource | ||
shell: bash | ||
run: | | ||
url=${{ inputs.url }} | ||
echo "Waiting for $url" | ||
until curl --fail --head --silent ${{ inputs.url }} > /dev/null | ||
do | ||
echo "." | ||
sleep 60 | ||
done | ||
echo "$url is available" |
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,27 @@ | ||
name: Create GitHub Release | ||
description: 'Create the release on GitHub with a changelog' | ||
inputs: | ||
milestone: | ||
description: 'Name of the GitHub milestone for which a release will be created' | ||
required: true | ||
pre-release: | ||
description: 'Whether the release is a pre-release (a milestone or release candidate)' | ||
required: false | ||
default: 'false' | ||
token: | ||
description: 'Token to use for authentication with GitHub' | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Generate Changelog | ||
uses: spring-io/github-changelog-generator@185319ad7eaa75b0e8e72e4b6db19c8b2cb8c4c1 #v0.0.11 | ||
with: | ||
config-file: .github/actions/create-github-release/changelog-generator.yml | ||
milestone: ${{ inputs.milestone }} | ||
token: ${{ inputs.token }} | ||
- name: Create GitHub Release | ||
shell: bash | ||
env: | ||
GITHUB_TOKEN: ${{ inputs.token }} | ||
run: gh release create ${{ format('v{0}', inputs.milestone) }} --notes-file changelog.md ${{ inputs.pre-release == 'true' && '--prerelease' || '' }} |
23 changes: 23 additions & 0 deletions
23
.github/actions/create-github-release/changelog-generator.yml
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,23 @@ | ||
changelog: | ||
repository: spring-projects/spring-webflow | ||
sections: | ||
- title: ":star: New Features" | ||
labels: | ||
- "type: enhancement" | ||
- title: ":lady_beetle: Bug Fixes" | ||
labels: | ||
- "type: bug" | ||
- "type: regression" | ||
- title: ":notebook_with_decorative_cover: Documentation" | ||
labels: | ||
- "type: documentation" | ||
- title: ":hammer: Dependency Upgrades" | ||
sort: "title" | ||
labels: | ||
- "type: dependency-upgrade" | ||
contributors: | ||
exclude: | ||
names: | ||
- "bclozel" | ||
- "rstoyanchev" | ||
- "snicoll" |
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,43 @@ | ||
name: Sync to Maven Central | ||
description: 'Syncs a release to Maven Central and waits for it to be available for use' | ||
inputs: | ||
jfrog-cli-config-token: | ||
description: 'Config token for the JFrog CLI' | ||
required: true | ||
ossrh-s01-staging-profile: | ||
description: 'Staging profile to use when syncing to Central' | ||
required: true | ||
ossrh-s01-token-password: | ||
description: 'Password for authentication with s01.oss.sonatype.org' | ||
required: true | ||
ossrh-s01-token-username: | ||
description: 'Username for authentication with s01.oss.sonatype.org' | ||
required: true | ||
spring-webflow-version: | ||
description: 'Version of Spring Webflow that is being synced to Central' | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Set Up JFrog CLI | ||
uses: jfrog/setup-jfrog-cli@9fe0f98bd45b19e6e931d457f4e98f8f84461fb5 # v4.4.1 | ||
env: | ||
JF_ENV_SPRING: ${{ inputs.jfrog-cli-config-token }} | ||
- name: Download Release Artifacts | ||
shell: bash | ||
run: jf rt download --spec ${{ format('{0}/artifacts.spec', github.action_path) }} --spec-vars 'buildName=${{ format('spring-webflow-{0}', inputs.spring-webflow-version) }};buildNumber=${{ github.run_number }}' | ||
- name: Sync | ||
uses: spring-io/nexus-sync-action@42477a2230a2f694f9eaa4643fa9e76b99b7ab84 # v0.0.1 | ||
with: | ||
close: true | ||
create: true | ||
generate-checksums: true | ||
password: ${{ inputs.ossrh-s01-token-password }} | ||
release: true | ||
staging-profile-name: ${{ inputs.ossrh-s01-staging-profile }} | ||
upload: true | ||
username: ${{ inputs.ossrh-s01-token-username }} | ||
- name: Await | ||
uses: ./.github/actions/await-http-resource | ||
with: | ||
url: ${{ format('https://repo.maven.apache.org/maven2/org/springframework/webflow/spring-webflow/{0}/spring-webflow-{0}.jar', inputs.spring-webflow-version) }} |
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,20 @@ | ||
{ | ||
"files": [ | ||
{ | ||
"aql": { | ||
"items.find": { | ||
"$and": [ | ||
{ | ||
"@build.name": "${buildName}", | ||
"@build.number": "${buildNumber}", | ||
"path": { | ||
"$nmatch": "org/springframework/webflow/webflow/webflow-*.zip" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"target": "nexus/" | ||
} | ||
] | ||
} |
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,84 @@ | ||
name: Release | ||
on: | ||
push: | ||
tags: | ||
- v3.0.[0-9]+ | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
jobs: | ||
build-and-stage-release: | ||
name: Build and Stage Release | ||
if: ${{ github.repository == 'spring-projects/spring-webflow' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check Out Code | ||
uses: actions/checkout@v4 | ||
- name: Build and Publish | ||
id: build-and-publish | ||
uses: ./.github/actions/build | ||
with: | ||
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} | ||
opensource-repository-password: ${{ secrets.ARTIFACTORY_PASSWORD }} | ||
opensource-repository-username: ${{ secrets.ARTIFACTORY_USERNAME }} | ||
publish: true | ||
- name: Stage Release | ||
uses: spring-io/artifactory-deploy-action@26bbe925a75f4f863e1e529e85be2d0093cac116 # v0.0.1 | ||
with: | ||
artifact-properties: | | ||
/**/webflow-*.zip::zip.name=spring-webflow,zip.deployed=false | ||
/**/webflow-*-docs.zip::zip.type=docs | ||
/**/webflow-*-dist.zip::zip.type=dist | ||
/**/webflow-*-schema.zip::zip.type=schema | ||
build-name: ${{ format('spring-webflow-{0}', steps.build-and-publish.outputs.version)}} | ||
folder: 'deployment-repository' | ||
password: ${{ secrets.ARTIFACTORY_PASSWORD }} | ||
repository: 'libs-staging-local' | ||
signing-key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
signing-passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
uri: 'https://repo.spring.io' | ||
username: ${{ secrets.ARTIFACTORY_USERNAME }} | ||
outputs: | ||
version: ${{ steps.build-and-publish.outputs.version }} | ||
sync-to-maven-central: | ||
name: Sync to Maven Central | ||
needs: | ||
- build-and-stage-release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check Out Code | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
- name: Sync to Maven Central | ||
uses: ./.github/actions/sync-to-maven-central | ||
with: | ||
jfrog-cli-config-token: ${{ secrets.JF_ARTIFACTORY_SPRING }} | ||
ossrh-s01-staging-profile: ${{ secrets.OSSRH_S01_STAGING_PROFILE }} | ||
ossrh-s01-token-password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} | ||
ossrh-s01-token-username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} | ||
spring-webflow-version: ${{ needs.build-and-stage-release.outputs.version }} | ||
promote-release: | ||
name: Promote Release | ||
needs: | ||
- build-and-stage-release | ||
- sync-to-maven-central | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up JFrog CLI | ||
uses: jfrog/setup-jfrog-cli@9fe0f98bd45b19e6e931d457f4e98f8f84461fb5 # v4.4.1 | ||
env: | ||
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} | ||
- name: Promote build | ||
run: jfrog rt build-promote ${{ format('spring-webflow-{0}', needs.build-and-stage-release.outputs.version)}} ${{ github.run_number }} libs-release-local | ||
create-github-release: | ||
name: Create GitHub Release | ||
needs: | ||
- build-and-stage-release | ||
- promote-release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check Out Code | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
- name: Create GitHub Release | ||
uses: ./.github/actions/create-github-release | ||
with: | ||
milestone: ${{ needs.build-and-stage-release.outputs.version }} | ||
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} |