-
Notifications
You must be signed in to change notification settings - Fork 1
110 lines (103 loc) · 4.24 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Build and Publish Cohort SDK NPMs
on:
#workflow_call:
push:
env:
SDK_JS_PACKAGE_NAME: "@kindredgroup/cohort_sdk_js"
SDK_CLIENT_PACKAGE_NAME: "@kindredgroup/cohort_sdk_client"
jobs:
npm:
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
dirSdkJs: packages/cohort_sdk_js
dirSdkJsClient: 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 "NPM_CONFIG_USERCONFIG=$NPM_CONFIG_USERCONFIG"
cat $NPM_CONFIG_USERCONFIG
echo ""
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 "D: selectNodeName=$selectNodeName"
echo "D: currentVersion=$currentVersion"
echo "D: currentSha=$currentSha"
echo "D: 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 -lah
rm package-lock.json || true
echo "Running: npm install "$SDK_JS_PACKAGE_NAME@$SDK_JS_PACKAGE_VERSION" --foreground-scripts"
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 "D: selectNodeName=$selectNodeName"
echo "D: currentVersion=$currentVersion"
echo "D: currentSha=$currentSha"
echo "D: newVersion=$newVersion"
npm version $newVersion
ls -lah
echo ""
- name: Build and Publishing ${{ matrix.settings.dirSdkJsClient }}
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |-
cd ${{ matrix.settings.dirSdkJsClient }}
pwd
ls -l
echo "Current version is"
npm version
npm ci --foreground-scripts
npm run build --foreground-scripts
npm publish --foreground-scripts
echo ""