-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (85 loc) · 3.49 KB
/
npm_publish_light.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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: echo "No customizations needed"
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"
echo "cat .npmrc"
cat .npmrc
cd ${{ matrix.settings.dirSdkJs }}
pwd
ls -l
npm ci --foreground-scripts
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 --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 ""