Skip to content

CI for WebHelp Contribution #1545

CI for WebHelp Contribution

CI for WebHelp Contribution #1545

Workflow file for this run

name: CI for WebHelp Contribution
on:
push:
pull_request:
workflow_dispatch:
inputs:
zowe-version:
description: "Specify the Zowe verison (vX.X.X)"
required: false
release:
description: "Create a release with the artifact"
default: false
required: true
type: boolean
jobs:
test:
runs-on: ubuntu-latest
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && !contains(github.event.head_commit.message, '[ci skip]')
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js LTS
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Setup .npmrc
id: setup-npmrc
run: npm config set @zowe:registry=https://zowe.jfrog.io/zowe/api/npm/npm-local-release/
- name: Install Node Package Dependencies
id: install-node
run: |
npm i --prod
npm install -g puppeteer-cli
- name: Install PIP Dependencies
id: install-pip
if: ${{ github.event.inputs.zowe-version && github.event.inputs.zowe-version != '' }}
run: pip3 install yq
- name: Set up Zowe from Versions
id: get-version-from-workflow
if: ${{ github.event.inputs.zowe-version && github.event.inputs.zowe-version != '' }}
run: |
curl -s https://raw.githubusercontent.com/zowe/zowe-cli-standalone-package/${{ github.event.inputs.zowe-version }}/master/zowe-versions.yaml > __zowe__version__
npm install -g @zowe/cli@$(yq '.packages.cli."zowe-v1-lts"' __zowe__version__ | tr -d '"')
zowe plugins install @zowe/cics-for-zowe-cli@$(yq '.packages."cics-for-zowe-cli"."zowe-v1-lts"' __zowe__version__ | tr -d '"')
zowe plugins install @zowe/db2-for-zowe-cli@$(yq '.packages."db2-for-zowe-cli"."zowe-v1-lts"' __zowe__version__ | tr -d '"')
zowe plugins install @zowe/ims-for-zowe-cli@$(yq '.packages."ims-for-zowe-cli"."zowe-v1-lts"' __zowe__version__ | tr -d '"')
zowe plugins install @zowe/mq-for-zowe-cli@$(yq '.packages."mq-for-zowe-cli"."zowe-v1-lts"' __zowe__version__ | tr -d '"')
zowe plugins install @zowe/secure-credential-store-for-zowe-cli@$(yq '.packages."secure-credential-store-for-zowe-cli"."zowe-v1-lts"' __zowe__version__ | tr -d '"')
zowe plugins install @zowe/zos-ftp-for-zowe-cli@$(yq '.packages."zos-ftp-for-zowe-cli"."zowe-v1-lts"' __zowe__version__ | tr -d '"')
rm __zowe__version__
- name: Set Up Zowe
id: setup-zowe
if: ${{ steps.get-version-from-workflow.outcome == 'skipped' }}
run: |
npm install -g @zowe/cli@zowe-v1-lts
zowe plugins install @zowe/cics-for-zowe-cli@zowe-v1-lts
zowe plugins install @zowe/db2-for-zowe-cli@zowe-v1-lts
zowe plugins install @zowe/ims-for-zowe-cli@zowe-v1-lts
zowe plugins install @zowe/mq-for-zowe-cli@zowe-v1-lts
zowe plugins install @zowe/secure-credential-store-for-zowe-cli@zowe-v1-lts
zowe plugins install @zowe/zos-ftp-for-zowe-cli@zowe-v1-lts
- name: Get Zowe version
id: get-version
if: ${{ steps.get-version-from-workflow.outcome == 'skipped' }}
run: echo "number=$(echo 'CLI_v'$(npx zowe --version))" >> $GITHUB_OUTPUT
- name: Build Web Help
id: build
run: |
which zowe || true
zowe --version || true
npm run build:local -- ${{ github.event.inputs.zowe-version || steps.get-version.outputs.number }}
export margin="0.4in"
puppeteer print ./generatedWebHelp/docs/all.html ./zowe.pdf --margin-top $margin --margin-right $margin --margin-bottom $margin --margin-left $margin --no-sandbox
- name: Archive Results
id: upload
if: ${{ always() && steps.build.outcome == 'success' }}
uses: actions/upload-artifact@v3
with:
name: results
path: |
generatedWebHelp/
zowe.pdf
- name: Prepare Release Artifacts
id: release-prepare
if: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/zowe-v1-lts') && steps.build.outcome == 'success' && github.event_name == 'workflow_dispatch' && github.event.inputs.zowe-version && github.event.inputs.zowe-version != '' && github.event.inputs.release == 'true' }}
run: |
mkdir release
mv zowe.pdf release/.
mv generatedWebHelp release/.
cd release
mv "generatedWebHelp" "zowe-${{ github.event.inputs.zowe-version }}-WebHelp"
mv "zowe.pdf" "zowe-${{ github.event.inputs.zowe-version }}.pdf"
TZ=UTC find . -exec touch -t 197001010000.00 {} +
zip -roX "zowe-${{ github.event.inputs.zowe-version }}-WebHelp.zip" "zowe-${{ github.event.inputs.zowe-version }}-WebHelp"
TZ=UTC touch -t 197001010000.00 zowe-${{ github.event.inputs.zowe-version }}-WebHelp.zip
- name: Create Release
id: release-create
if: ${{ steps.release-prepare.outcome == 'success' }}
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
prerelease: false
name: ${{ github.event.inputs.zowe-version }}
tag: ${{ github.event.inputs.zowe-version }}
body: |
Zowe CLI Web-Help for Zowe Release ${{ github.event.inputs.zowe-version }}
artifacts: "release/zowe-${{ github.event.inputs.zowe-version }}.pdf,release/zowe-${{ github.event.inputs.zowe-version }}-WebHelp.zip"