Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
mohnoor94 committed Sep 17, 2024
1 parent 4865e58 commit 7679120
Showing 1 changed file with 41 additions and 21 deletions.
62 changes: 41 additions & 21 deletions .github/workflows/release-sdk.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,52 @@
name: Release SDK to Maven Central
name: Release SDK to NPM

on:
workflow_dispatch:
inputs:
channel:
description: 'Choose the release channel/tag'
type: choice
options:
- beta
- production
default: 'beta'

jobs:
release-sdk:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
java-version: 21
distribution: 'temurin'
server-id: oss-sonatype
server-username: SONATYPE_USERNAME
server-password: SONATYPE_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
settings-path: ${{ github.workspace }}
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Publish
- name: Release
working-directory: code
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "Releasing..."
cd code
gradle clean build publish -Psigning.gnupg.passphrase=$GPG_PASSPHRASE --no-daemon
curr_version="$(npm pkg get version | sed "s/\"//g")"
if [ "${{ inputs.channel }}" == "production" ]; then
echo "Publishing a production release: $curr_version"
npm i
npx tsc
npm publish
elif [ "${{ inputs.channel }}" == "beta" ]; then
suffix_pattern="-beta.[0-9]+"
if [[ ! "$curr_version" =~ $suffix_pattern$ ]]; then
version="$curr_version-beta.$(date +%s)"
else
version="$curr_version"
fi
echo "Publishing a beta release: $version"
npm version "$version" --allow-same-version
npm i
npx tsc
npm publish --tag beta
fi

0 comments on commit 7679120

Please sign in to comment.