diff --git a/.github/workflows/reusable-release-sdk.yaml b/.github/workflows/reusable-release-sdk.yaml new file mode 100644 index 0000000..48463e7 --- /dev/null +++ b/.github/workflows/reusable-release-sdk.yaml @@ -0,0 +1,40 @@ +# Copyright AGNTCY Contributors (https://github.com/agntcy) +# SPDX-License-Identifier: Apache-2.0 + +name: Release SDK + +on: + workflow_dispatch: + +permissions: + contents: read + id-token: write # Required for npm OIDC trusted publishing + +jobs: + javascript: + name: JavaScript + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + + - name: Install Task + uses: go-task/setup-task@3be4020d41929789a01026e0e427a4321ce0ad44 #v2.0.0 + + - name: Setup Node + uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 + with: + node-version: "24.x" + registry-url: https://registry.npmjs.org/ + scope: "@agntcy" + + - name: Build the Javascript package + run: | + task sdk:deps:javascript + task sdk:build:javascript + + - name: Publish the Javascript SDK + run: | + task sdk:release:javascript diff --git a/Taskfile.yml b/Taskfile.yml index 2a51542..bef2f1b 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -91,3 +91,14 @@ tasks: #cd {{ .ROOT_DIR }}/sdk/examples/example-js #npm install #npm run example + + sdk:release:javascript: + desc: Release javascript client SDK package + cmd: | + version=$(npm pkg get version) + + if [[ $version == *"rc"* ]]; then + npm publish --scope=@agntcy --access public --tag rc-{{.COMMIT_SHA}} + else + npm publish --scope=@agntcy --access public + fi