-
Notifications
You must be signed in to change notification settings - Fork 506
88 lines (76 loc) · 3.04 KB
/
publish-release-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Publish release build
on:
push:
tags:
- '*.*.*'
jobs:
publish:
runs-on: ubuntu-latest
if: github.repository == 'pinterest/ktlint'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 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@v2
- name: Get version
id: get_version
if: ${{ success() }}
run: echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Create zip for dependency manager(s)
if: ${{ success() }}
run: |
cd ktlint-cli/build/run
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@v2
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: Update Release documentation
if: ${{ success() }}
run: |
git config user.email "[email protected]"
git config user.name "Ktlint Release Workflow" |
./.announce -y
env:
VERSION: ${{ env.version }}