-
Notifications
You must be signed in to change notification settings - Fork 6
118 lines (103 loc) · 3.53 KB
/
publish.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
117
118
---
name: publish
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+
concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: false
env:
GRADLE_SWITCHES: --console=plain --info --stacktrace --warning-mode=all --no-daemon
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.gradle_enterprise_access_key }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.ossrh_username }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.ossrh_token }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ossrh_signing_key }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ossrh_signing_password }}
RELEASE_BUILD: "true"
RELEASE_PUBLICATION: "true"
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- uses: actions/[email protected]
with:
distribution: temurin
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
develocity-access-key: ${{ secrets.gradle_enterprise_access_key }}
- name: Update package.json version from tag
working-directory: openrewrite
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/}
echo "Release tag is $TAG_VERSION"
npm version $TAG_VERSION --no-git-tag-version
- name: publish-npm
working-directory: openrewrite
run: |
npm ci
npm run build
npm publish --access public
npm pack
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: npm install embedded
run: |
npm install @openrewrite/rewrite-remote
npm install ../../../../../openrewrite/openrewrite-rewrite-*.tgz
working-directory: rewrite-javascript-remote-server/src/main/resources/node-server
- name: build-java
run: |
./gradlew assemble
git reset --hard
- name: publish-candidate
if: contains(github.ref, '-rc.')
run: |
./gradlew \
${{ env.GRADLE_SWITCHES }} \
-Preleasing \
-Prelease.disableGitChecks=true \
-Prelease.useLastTag=true \
candidate \
publish \
closeAndReleaseSonatypeStagingRepository
- name: publish-release
if: (!contains(github.ref, '-rc.'))
run: |
./gradlew \
${{ env.GRADLE_SWITCHES }} \
-Preleasing \
-Prelease.disableGitChecks=true \
-Prelease.useLastTag=true \
final \
publish \
closeAndReleaseSonatypeStagingRepository
- name: Update package.json version from tag
working-directory: openrewrite
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/}
echo "Release tag is $TAG_VERSION"
npm version $TAG_VERSION --no-git-tag-version
- name: Commit version updates
working-directory: openrewrite
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add package.json package-lock.json
git commit -m "bump version ${GITHUB_REF#refs/tags/}"
git push https://${GH_TOKEN}@github.com/openrewrite/rewrite-javascript.git HEAD:main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}