Prepare for 1.1.0 release (#2443) #13
Workflow file for this run
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: Publish release build | |
on: | |
push: | |
tags: | |
- '*.*.*' | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
if: github.repository == 'pinterest/ktlint' | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
ref: 'master' | |
- uses: ./.github/actions/setup-gradle-build | |
- name: Build executable and publish to Maven | |
run: ./gradlew clean shadowJarExecutable publishMavenPublicationToMavenCentralRepository --no-daemon --no-parallel --no-configuration-cache | |
env: | |
SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }} | |
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID }} | |
ORG_GRADLE_PROJECT_signingKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }} | |
- name: Validate changelog.md | |
id: validate_changelog | |
if: ${{ success() }} | |
run: | | |
FIRST_HEADING2=$(grep "^## " CHANGELOG.md | head -n 1) | |
echo "First heading2 found: $FIRST_HEADING2" | |
if [[ ! "$FIRST_HEADING2" =~ ^##[[:space:]]\[[0-9]+\.[0-9]+\.[0-9]+\][[:space:]]-[[:space:]][0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then | |
echo "First heading at level 2 should match '## [X.Y.Z] - [YYYY-MM-DD]'" | |
exit 1 | |
fi | |
- name: Extract release notes | |
id: release_notes | |
if: ${{ success() }} | |
uses: ffurrer2/extract-release-notes@v1 | |
- name: Get version | |
id: get_version | |
if: ${{ success() }} | |
run: echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
- name: Create zip for dependency managers | |
if: ${{ success() }} | |
run: | | |
cd ktlint-cli/build/run | |
# Doing this for Homebrew and https://github.com/sdkman/sdkman-cli/wiki/Well-formed-SDK-archives | |
mkdir -p ktlint-${{ env.version }}/bin | |
cp ktlint ktlint-${{ env.version }}/bin | |
zip -rm ktlint-${{ env.version }}.zip ktlint-${{ env.version }} | |
- name: Create release | |
id: github_release | |
if: ${{ success() }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: false | |
prerelease: false | |
body: ${{ steps.release_notes.outputs.release_notes }} | |
files: | | |
ktlint-cli/build/run/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Bump Homebrew Formula | |
if: ${{ success() }} | |
uses: mislav/bump-homebrew-formula-action@v2 | |
env: | |
COMMITTER_TOKEN: ${{ secrets.HOMEBREW_TOKEN }} | |
with: | |
formula-name: ktlint | |
formula-path: Formula/k/ktlint.rb | |
download-url: https://github.com/pinterest/ktlint/releases/download/${{ env.version }}/ktlint-${{ env.version }}.zip | |
# - name: Release to sdkman | |
# if: ${{ success() }} | |
# env: | |
# SDKMAN_KEY: ${{ secrets.SDKMAN_KEY }} | |
# SDKMAN_TOKEN: ${{ secrets.SDKMAN_TOKEN }} | |
# SDKMAN_VERSION: ${{ env.version }} | |
# run: ./gradlew :ktlint-cli:sdkMajorRelease | |
- name: Update Release documentation | |
if: ${{ success() }} | |
run: | | |
git config user.email "<>" | | |
git config user.name "Ktlint Release Workflow" | | |
./.announce -y | |
env: | |
VERSION: ${{ env.version }} |