Skip to content

Commit

Permalink
add jar to embed and bundle JS server as a jar (#173)
Browse files Browse the repository at this point in the history
* add jar to embed and bundle JS server as a jar

* add license fix

* add reset of the package.json after installation
  • Loading branch information
OlegDokuka authored Dec 18, 2024
1 parent fb88e28 commit 15c2a70
Show file tree
Hide file tree
Showing 9 changed files with 267 additions and 832 deletions.
31 changes: 19 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,7 @@ env:

jobs:
build:
uses: openrewrite/gh-automation/.github/workflows/ci-gradle.yml@main
secrets:
gradle_enterprise_access_key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
gradle_enterprise_cache_username: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
gradle_enterprise_cache_password: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
ossrh_username: ${{ secrets.OSSRH_USERNAME }}
ossrh_token: ${{ secrets.OSSRH_TOKEN }}
ossrh_signing_key: ${{ secrets.OSSRH_SIGNING_KEY }}
ossrh_signing_password: ${{ secrets.OSSRH_SIGNING_PASSWORD }}

node-build:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand Down Expand Up @@ -65,3 +53,22 @@ jobs:
working-directory: openrewrite
- run: npm run test
working-directory: openrewrite
- run: npm pack
working-directory: openrewrite

- name: npm install embedded
run: |
npm install @openrewrite/rewrite-remote
npm install ../../../../openrewrite/openrewrite-rewrite-*.tgz
git checkout HEAD -- package.json
working-directory: rewrite-javascript-remote-server/src/main/resources

- name: publish-java-snapshots
if: github.event_name != 'pull_request'
run: ./gradlew ${{ env.GRADLE_SWITCHES }} assemble snapshot publish -PforceSigning -x test
env:
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 }}

60 changes: 52 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ 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:
uses: openrewrite/gh-automation/.github/workflows/publish-gradle.yml@main
secrets:
gradle_enterprise_access_key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
ossrh_username: ${{ secrets.OSSRH_USERNAME }}
ossrh_token: ${{ secrets.OSSRH_TOKEN }}
ossrh_signing_key: ${{ secrets.OSSRH_SIGNING_KEY }}
ossrh_signing_password: ${{ secrets.OSSRH_SIGNING_PASSWORD }}
release-js:
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -35,6 +37,16 @@ jobs:
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: |
Expand All @@ -59,5 +71,37 @@ jobs:
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
git checkout HEAD -- package.json
working-directory: rewrite-javascript-remote-server/src/main/resources

- 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ bin/
/js/dist
/js/node_modules/
.vscode/*
/rewrite-javascript-remote-server/src/main/resources/node_modules/
/rewrite-javascript-remote-server/src/main/resources/package-lock.json
1 change: 1 addition & 0 deletions openrewrite/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ yarn-error.log*
.env.*.local

tsconfig.build.tsbuildinfo
/openrewrite-rewrite-*.tgz
Loading

0 comments on commit 15c2a70

Please sign in to comment.