Skip to content

Commit

Permalink
feat: Publish sdk to GH Actions Packages
Browse files Browse the repository at this point in the history
  • Loading branch information
fmarek-kindred committed Oct 5, 2023
1 parent a4eb300 commit 82f9971
Show file tree
Hide file tree
Showing 26 changed files with 796 additions and 3,859 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: cohort_sdk_js
on:
#workflow_call:
push:
workflow_call:
#push:
env:
DEBUG: "napi:*"
OPENSSL_DIR: /usr/local/Cellar/[email protected]/1.1.1w
Expand Down
89 changes: 89 additions & 0 deletions .github/workflows/npm_publish_light.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Build and Publish Cohort SDK NPSs
on:
#workflow_call:
push:
env:
SDK_JS_PACKAGE_NAME: "@talos/cohort_sdk_js"
SDK_CLIENT_PACKAGE_NAME: "@talos/cohort_sdk_client"
jobs:
npm:
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
dirSdkJs: packages/cohort_sdk_js
dirSdkJsClient: packages/cohort_sdk_client
customiseHostCommand: brew install yq

name: stable - ${{ matrix.settings.target }} - node@16
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true
registry-url: "https://npm.pkg.github.com"

- name: Customise host image
shell: bash
run: ${{ matrix.settings.customiseHostCommand }}

- name: Setup version for ${{ matrix.settings.dirSdkJs }}
id: sdk-js-version
shell: bash
run: |-
echo "Building SDK JS Library"
cd ${{ matrix.settings.dirSdkJs }}
pwd
ls -l
npm ci -verbose
selectNodeName=${{ env.SDK_JS_PACKAGE_NAME }}
currentVersion=$(npm version | yq .$selectNodeName)
currentSha=$(git rev-parse --short HEAD)
newVersion="$currentVersion-$currentSha"
echo "DEBUG: selectNodeName=$selectNodeName"
echo "DEBUG: currentVersion=$currentVersion"
echo "DEBUG: currentSha=$currentSha"
echo "DEBUG: newVersion=$newVersion"
npm version $newVersion
echo "SDK_JS_PACKAGE_VERSION=$newVersion" >> "$GITHUB_OUTPUT"
echo ""
- name: Publishing ${{ matrix.settings.dirSdkJs }}
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |-
cd ${{ matrix.settings.dirSdkJs }}
pwd
ls -l
echo "Current version is"
npm version
npm publish --access private --foreground-scripts
echo ""
- name: Setup version for ${{ matrix.settings.dirSdkJsClient }}
env:
SDK_JS_PACKAGE_VERSION: ${{ steps.sdk-js-version.outputs.SDK_JS_PACKAGE_VERSION }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |-
echo "Building SDK Client"
cd ${{ matrix.settings.dirSdkJsClient }}
pwd
ls -l
npm install "$SDK_JS_PACKAGE_NAME@$SDK_JS_PACKAGE_VERSION" --foreground-scripts
selectNodeName=${{ env.SDK_CLIENT_PACKAGE_NAME }}
currentVersion=$(npm version | yq .$selectNodeName)
currentSha=$(git rev-parse --short HEAD)
newVersion="$currentVersion-$currentSha"
echo "DEBUG: selectNodeName=$selectNodeName"
echo "DEBUG: currentVersion=$currentVersion"
echo "DEBUG: currentSha=$currentSha"
echo "DEBUG: newVersion=$newVersion"
npm version $newVersion
echo ""
62 changes: 58 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 82f9971

Please sign in to comment.