Skip to content

Zowe CLI Bundle

Zowe CLI Bundle #375

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