Release #29
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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Release version' | |
required: true | |
next: | |
description: 'Next version' | |
required: true | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
outputs: | |
JAR_SIZE: ${{ steps.bach.outputs.JAR_SIZE }} | |
JAR_CSUM: ${{ steps.bach.outputs.JAR_CSUM }} | |
DOC_SIZE: ${{ steps.bach.outputs.DOC_SIZE }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ vars.JAVA_VERSION }} | |
distribution: ${{ vars.JAVA_DISTRO }} | |
cache: maven | |
- name: Cache Gradle | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }} | |
restore-keys: ${{ runner.os }}-gradle- | |
- name: Cache Gradle wrapper | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }} | |
restore-keys: ${{ runner.os }}-gradlew- | |
- name: Version | |
run: | | |
VERSION=${{ github.event.inputs.version }} | |
echo "Updating POMs to version $VERSION" | |
./mvnw -ntp -B versions:set versions:commit -DnewVersion=$VERSION | |
echo $VERSION > VERSION | |
sed -i -e "s/^\:project-version\:\ .*/:project-version: ${VERSION}/g" README.adoc | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "GitHub Action" | |
git commit -a -m "Releasing version $VERSION" | |
git push origin master | |
- name: Stage deploy | |
env: | |
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} | |
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} | |
run: | | |
./mvnw -ntp -B --file pom.xml -Ppublication -DaltDeploymentRepository=local::file:target/staging-deploy \ | |
-Dmaven.site.skip=true -Pgradle-release deploy | |
- name: Release | |
uses: jreleaser/release-action@v2 | |
env: | |
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }} | |
JRELEASER_GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }} | |
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} | |
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} | |
JRELEASER_SDKMAN_CONSUMER_KEY: ${{ secrets.SDKMAN_CONSUMER_KEY }} | |
JRELEASER_SDKMAN_CONSUMER_TOKEN: ${{ secrets.SDKMAN_CONSUMER_TOKEN }} | |
JRELEASER_TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} | |
JRELEASER_TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }} | |
JRELEASER_TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} | |
JRELEASER_TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} | |
JRELEASER_MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }} | |
JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
- name: Grab bach-info | |
id: bach | |
shell: bash | |
run: | | |
VERSION=${{ github.event.inputs.version }} | |
JAR_SIZE=$(ls -l pomchecker-toolprovider/target/pomchecker-toolprovider-${VERSION}.jar | awk '{print $5}') | |
JAR_CSUM=$(shasum -a 256 pomchecker-toolprovider/target/pomchecker-toolprovider-${VERSION}.jar | awk '{print $1}') | |
DOC_SIZE=$(ls -l README.adoc | awk '{print $5}') | |
echo "JAR_SIZE=$(echo $JAR_SIZE)" >> $GITHUB_OUTPUT | |
echo "JAR_CSUM=$(echo $JAR_CSUM)" >> $GITHUB_OUTPUT | |
echo "DOC_SIZE=$(echo $DOC_SIZE)" >> $GITHUB_OUTPUT | |
- name: JReleaser output | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jreleaser-release | |
path: | | |
out/jreleaser/trace.log | |
out/jreleaser/output.properties | |
- name: Build site | |
run: | | |
export GPG_TTY=$(tty) | |
./mvnw -ntp -B --file pom.xml \ | |
-Drepository.url=https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git \ | |
site site:stage -DstagingDirectory="${{ runner.temp }}/site" | |
- name: Publish site | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: "${{ runner.temp }}/site" | |
- name: Set next version | |
run: | | |
./mvnw -ntp -B versions:set versions:commit -DnewVersion=${{ github.event.inputs.next }} | |
sed -i -e "[email protected]>.*</[email protected]>\${git.commit.author.time}</project.build.outputTimestamp@g" pom.xml | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "GitHub Action" | |
git commit -a -m "Next version ${{ github.event.inputs.next }}" | |
git push origin master | |
update-bach-info: | |
name: Update bach-info | |
needs: [release] | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: kordamp/bach-info | |
ref: 'main' | |
fetch-depth: 0 | |
token: ${{ secrets.GIT_ACCESS_TOKEN }} | |
- name: Download bach-info script | |
run: | | |
curl -sL https://raw.githubusercontent.com/kordamp/pomchecker/master/.github/scripts/update-bach-info.sh --output update-bach-info.sh | |
chmod +x update-bach-info.sh | |
- name: Commit | |
env: | |
TAG: "v${{ github.event.inputs.version }}" | |
VERSION: ${{ github.event.inputs.version }} | |
JAR_SIZE: ${{ needs.release.outputs.JAR_SIZE }} | |
JAR_CSUM: ${{ needs.release.outputs.JAR_CSUM }} | |
DOC_SIZE: ${{ needs.release.outputs.DOC_SIZE }} | |
run: sh update-bach-info.sh |