Skip to content

fix release ci

fix release ci #72

Workflow file for this run

---
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: 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 }}
- 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
git checkout HEAD -- package.json
working-directory: rewrite-javascript-remote-server/src/main/resources/node-server
- 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