-
Notifications
You must be signed in to change notification settings - Fork 2
116 lines (98 loc) · 4.02 KB
/
publish_release.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Publish a release
on:
workflow_dispatch:
env:
VERSION_FILE: gradle.properties
VERSION_EXTRACT_PATTERN: '(?<=version=).+'
GH_USER_NAME: github.actor
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx16g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=1024m"
jobs:
publish_artifacts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PUSH_PAT }}
- name: Generate versions
uses: HardNorth/github-version-generate@v1
with:
version-source: file
version-file: ${{ env.VERSION_FILE }}
version-file-extraction-pattern: ${{ env.VERSION_EXTRACT_PATTERN }}
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version-file: .ci-java-version
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: wrapper
- name: Publish the artifacts
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }}
run: ./gradlew publishAllPublicationsToMavenCentralRepository -Pversion=${{ env.RELEASE_VERSION }}
- name: Create, checkout, and push release branch
run: |
git config user.name eygraber
git config user.email [email protected]
git checkout -b releases/${{ env.RELEASE_VERSION }}
git push origin releases/${{ env.RELEASE_VERSION }}
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GIT_SIGNING_PRIVATE_KEY }}
passphrase: ${{ secrets.GIT_SIGNING_PRIVATE_KEY_PASSWORD }}
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
- name: Store SHA of HEAD commit on ENV
run: echo "GIT_HEAD=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Create tag
id: create_tag
uses: actions/github-script@v7
with:
github-token: ${{ secrets.PUSH_PAT }}
script: |
const {GIT_HEAD} = process.env
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ env.RELEASE_VERSION }}",
sha: `${GIT_HEAD}`
})
- name: Build changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v5
with:
configuration: "changelog_config.json"
toTag: ${{ env.RELEASE_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
id: create_release
uses: ncipollo/release-action@v1
with:
body: ${{ steps.build_changelog.outputs.changelog }}
name: Release ${{ env.RELEASE_VERSION }}
tag: ${{ env.RELEASE_VERSION }}
token: ${{ secrets.PUSH_PAT }}
- uses: actions/checkout@v4
with:
ref: ${{ github.event.head_ref }}
token: ${{ secrets.PUSH_PAT }}
- name: Prepare next dev version
id: prepare_next_dev
run: |
sed -i -e 's/${{ env.CURRENT_VERSION }}/${{ env.NEXT_VERSION }}/g' gradle.properties && \
sed -i -E -e 's/(jsonpathkt-.*)[0-9]+\.[0-9]+\.[0-9]+/\1${{ env.RELEASE_VERSION }}/g' README.md
- name: Update package-lock.json if needed
run: ./gradlew kotlinUpgradePackageLock --no-build-cache --no-configuration-cache --rerun-tasks
- name: Commit next dev version
id: commit_next_dev
uses: EndBug/add-and-commit@v9
with:
add: "['gradle.properties', 'README.md', 'kotlin-js-store/package-lock.json']"
default_author: github_actions
message: "Prepare next dev version"