-
Notifications
You must be signed in to change notification settings - Fork 4
247 lines (219 loc) · 10.2 KB
/
zowe-cli-bundle.yaml
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
name: Zowe CLI Bundle
on:
workflow_call:
inputs:
dry-run:
required: true
type: boolean
package-tag:
required: true
type: string
release-type:
required: true
type: string
secrets:
JF_ARTIFACTORY_TOKEN:
required: true
workflow_dispatch:
inputs:
package-tag:
description: "Specify package tag to bundle"
default: zowe-v3-lts
required: true
type: choice
options:
- zowe-v1-lts
- zowe-v2-lts
- zowe-v3-lts
# - next
release-type:
description: "Specify type of deployment"
default: snapshot
required: true
type: choice
options:
- release
- snapshot
dry-run:
description: "Check to skip publishing to Artifactory"
default: false
required: false
type: boolean
license-version:
description: "Override version of Zowe Licenses ZIP"
required: false
jobs:
build:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js LTS
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'npm'
# Python 3.12 breaks node-gyp < 10, breaking current versions of Node 18/20 (as of Nov 9, 2023) - awharn
- name: Downgrade Python
uses: actions/setup-python@v5
with:
python-version: '3.11.5'
- name: Install Dependencies
run: npm ci
- name: Load Zowe Versions
id: versions
run: node scripts/load-zowe-versions.js ${{ inputs.package-tag }} ${{ inputs.release-type }}
env:
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
- name: Setup JFrog CLI
uses: jfrog/setup-jfrog-cli@v4
env:
JF_ENV_1: ${{ secrets.JF_ARTIFACTORY_TOKEN }}
- name: Download Zowe License ZIP
run: |
if [[ "${{ inputs.package-tag }}" != "next" ]]; then
jfrog rt dl --flat --fail-no-op libs-release-local/org/zowe/licenses/${{ github.event.inputs.license-version || steps.versions.outputs.tags_version }}/zowe_licenses_cli.zip /tmp/
else
jfrog rt dl --flat --fail-no-op libs-snapshot-local/org/zowe/licenses/${{ steps.versions.outputs.tags_version }}-next-SNAPSHOT/zowe_licenses_cli-SNAPSHOT.zip /tmp/
mv /tmp/zowe_licenses_cli-SNAPSHOT.zip /tmp/zowe_licenses_cli.zip
fi
- name: Create CLI Core Bundle
run: |
mkdir -p temp && cd temp
mkdir -p licenses && cd licenses && cp /tmp/zowe_licenses_cli.zip zowe_licenses_cli.zip && cd ..
npm pack @zowe/cli@${{ steps.versions.outputs.packages_cli }}
if [[ "${{ inputs.package-tag }}" == "zowe-v1-lts" ]]; then
npm pack @zowe/secure-credential-store-for-zowe-cli@${{ steps.versions.outputs.packages_secure-credential-store-for-zowe-cli }}
fi
bash ../scripts/repackage_bundle.sh *.tgz
mv zowe-cli-package.zip ../zowe-cli-package-${{ env.BUNDLE_VERSION }}.zip
rm -rf *
- name: Create CLI Plugins Bundle
run: |
mkdir -p temp && cd temp
mkdir -p licenses && cd licenses && cp /tmp/zowe_licenses_cli.zip zowe_licenses_cli.zip && cd ..
npm pack @zowe/cics-for-zowe-cli@${{ steps.versions.outputs.packages_cics-for-zowe-cli }}
npm pack @zowe/db2-for-zowe-cli@${{ steps.versions.outputs.packages_db2-for-zowe-cli }}
npm pack @zowe/mq-for-zowe-cli@${{ steps.versions.outputs.packages_mq-for-zowe-cli }}
npm pack @zowe/zos-ftp-for-zowe-cli@${{ steps.versions.outputs.packages_zos-ftp-for-zowe-cli }}
if [[ "${{ inputs.package-tag }}" =~ "zowe-v[12]-lts" ]]; then
npm pack @zowe/ims-for-zowe-cli@${{ steps.versions.outputs.packages_ims-for-zowe-cli }}
fi
bash ../scripts/repackage_bundle.sh *.tgz
mv zowe-cli-package.zip ../zowe-cli-plugins-${{ env.BUNDLE_VERSION }}.zip
rm -rf *
- name: Create Node.js SDK Bundle
run: |
mkdir -p temp && cd temp
mkdir -p licenses && cd licenses && cp /tmp/zowe_licenses_cli.zip zowe_licenses_cli.zip && cd ..
npm pack @zowe/imperative@${{ steps.versions.outputs.packages_imperative }}
npm pack @zowe/core-for-zowe-sdk@${{ steps.versions.outputs.package_core-for-zowe-sdk }}
npm pack @zowe/provisioning-for-zowe-sdk@${{ steps.versions.outputs.packages_provisioning-for-zowe-sdk }}
npm pack @zowe/secrets-for-zowe-sdk@${{ steps.versions.outputs.packages_secrets-for-zowe-sdk }}
npm pack @zowe/zos-console-for-zowe-sdk@${{ steps.versions.outputs.packages_zos-console-for-zowe-sdk }}
npm pack @zowe/zos-files-for-zowe-sdk@${{ steps.versions.outputs.packages_zos-files-for-zowe-sdk }}
npm pack @zowe/zos-jobs-for-zowe-sdk@${{ steps.versions.outputs.packages_zos-jobs-for-zowe-sdk }}
npm pack @zowe/zos-logs-for-zowe-sdk@${{ steps.versions.outputs.packages_zos-logs-for-zowe-sdk }}
npm pack @zowe/zos-tso-for-zowe-sdk@${{ steps.versions.outputs.packages_zos-tso-for-zowe-sdk }}
npm pack @zowe/zos-uss-for-zowe-sdk@${{ steps.versions.outputs.packages_zos-uss-for-zowe-sdk }}
npm pack @zowe/zos-workflows-for-zowe-sdk@${{ steps.versions.outputs.packages_zos-workflows-for-zowe-sdk }}
npm pack @zowe/zosmf-for-zowe-sdk@${{ steps.versions.outputs.packages_zosmf-for-zowe-sdk }}
bash ../scripts/repackage_bundle.sh *.tgz
mv zowe-cli-package.zip ../zowe-nodejs-sdk-${{ env.BUNDLE_VERSION }}.zip
bash ../scripts/generate_typedoc.sh ${{ env.BUNDLE_VERSION_SHORT }} ${{ steps.versions.outputs.packages_cli }}
mv zowe-node-sdk-typedoc.zip ../zowe-nodejs-sdk-typedoc-${{ env.BUNDLE_VERSION }}.zip
rm -rf *
- name: Create Python SDK Bundle
run: |
mkdir -p temp && cd temp
mkdir -p licenses && cd licenses && cp /tmp/zowe_licenses_cli.zip zowe_licenses_cli.zip && cd ..
if [[ "${{ inputs.package-tag }}" != "zowe-v1-lts" ]]; then
pip3 download --no-binary charset-normalizer,pyrsistent,pyyaml --pre zowe-python-sdk-bundle
# Download Secrets SDK binary wheels for all platforms
curl -fs https://pypi.org/project/zowe-secrets-for-zowe-sdk/#files |
grep -Eo 'href="[^"]+\.whl"' | cut -d '"' -f 2 |
while read -r url; do curl -fLOJ $url; done
else
pip3 download --no-binary charset-normalizer,pyyaml zowe
fi
TZ=UTC find . -exec touch -t 197001010000.00 {} +
TZ=UTC zip -roX zowe-sdk.zip *
mv zowe-sdk.zip ../zowe-python-sdk-${{ env.BUNDLE_VERSION }}.zip
rm -rf *
- name: Update Timestamps
run: TZ=UTC find . -maxdepth 1 -name "*.zip" -type f -exec touch -t 197001010000.00 {} +
- name: Archive Build Artifacts
uses: actions/upload-artifact@v4
with:
name: 'zowe-cli-bundle_${{ inputs.package-tag }}'
path: '*.zip'
- name: Add Bundles to Spec
run: |
node scripts/prepare-upload.js "zowe-cli-package-${{ env.BUNDLE_VERSION }}.zip" \
"libs-${{ inputs.release-type }}-local/org/zowe/cli/zowe-cli-package/${{ env.BUNDLE_VERSION_SHORT }}/"
node scripts/prepare-upload.js "zowe-cli-plugins-${{ env.BUNDLE_VERSION }}.zip" \
"libs-${{ inputs.release-type }}-local/org/zowe/cli/zowe-cli-plugins/${{ env.BUNDLE_VERSION_SHORT }}/"
node scripts/prepare-upload.js "zowe-nodejs-sdk*-${{ env.BUNDLE_VERSION }}.zip" \
"libs-${{ inputs.release-type }}-local/org/zowe/sdk/zowe-nodejs-sdk/${{ env.BUNDLE_VERSION_SHORT }}/"
node scripts/prepare-upload.js "zowe-python-sdk*-${{ env.BUNDLE_VERSION }}.zip" \
"libs-${{ inputs.release-type }}-local/org/zowe/sdk/zowe-python-sdk/${{ env.BUNDLE_VERSION_SHORT }}/"
- name: Publish to Artifactory
id: publish
if: ${{ inputs.dry-run == false }}
run: jfrog rt u --detailed-summary --spec upload-spec.json
- name: Find Current PR
id: find-pr
if: ${{ steps.publish.outcome == 'success' || inputs.dry-run == true }}
uses: jwalton/gh-find-current-pr@v1
with:
state: ${{ inputs.release-type == 'release' && 'all' || 'open' }}
- name: Comment on PR
if: ${{ steps.find-pr.outputs.number && inputs.dry-run == false && inputs.release-type == 'release' }}
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ steps.find-pr.outputs.pr }}
path: summary.md
- name: Comment on PR (Dry Run)
if: ${{ steps.find-pr.outputs.number && inputs.dry-run == true }}
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ steps.find-pr.outputs.pr }}
message: |
Dry run build succeeded for Zowe CLI bundle v${{ env.BUNDLE_VERSION }} (`${{ inputs.package-tag }}`)!
To create a Release Candidate bundle, run the workflow [here](https://github.com/zowe/zowe-cli-standalone-package/actions/workflows/zowe-cli-bundle.yaml) for this branch and select type "release".
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x]
os: [windows-latest, ubuntu-latest, macos-latest, macos-13]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Bundle Artifact
uses: actions/download-artifact@v4
with:
name: 'zowe-cli-bundle_${{ inputs.package-tag }}'
path: 'zowe-cli-bundle'
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
check-latest: true
# Python 3.12 breaks node-gyp < 10, breaking current versions of Node 18/20 (as of Nov 9, 2023) - awharn
- name: Downgrade Python
uses: actions/setup-python@v5
with:
python-version: '3.11.5'
- name: Install CLI
shell: bash
working-directory: zowe-cli-bundle
run: unzip -o zowe-cli-package-*.zip && npm install -g zowe-cli.tgz
- name: Install Plugins
shell: bash
working-directory: zowe-cli-bundle
run: unzip -o zowe-cli-plugins-*.zip && node ../scripts/install-check.js && zowe plugins install *-for-zowe-cli.tgz && zowe plugins validate --fail-on-error