Zowe CLI Deploy Component #220
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Zowe CLI Deploy Component | |
| on: | |
| workflow_call: | |
| inputs: | |
| pkg-name: | |
| required: true | |
| type: string | |
| pkg-tags: | |
| required: true | |
| type: string | |
| cli-deploy-all-workflow-id: | |
| description: "The workflow ID from the CLI Deploy All Workflow. This should NOT be specified by any other calling workflow." | |
| required: false | |
| type: string | |
| secrets: | |
| NPM_PUBLIC_TOKEN: | |
| required: true | |
| workflow_dispatch: | |
| inputs: | |
| pkg-name: | |
| description: "Name of the package to be deployed (the @zowe scope will be prepended)" | |
| default: "cli" | |
| required: true | |
| pkg-tags: | |
| description: "Tags to be distributed from Artifactory (separate multiple by spaces)" | |
| default: "latest" | |
| required: true | |
| permissions: | |
| issues: write | |
| id-token: write | |
| actions: read | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| env: | |
| PKG_NAME: ${{ inputs.pkg-name }} | |
| PKG_TAGS: ${{ inputs.pkg-tags }} | |
| NPM_CONFIG_PROVENANCE: "false" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: 'zowe/zowe-cli-standalone-package' | |
| - name: Use Node.js LTS | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| cache: ${{ (!env.ACT && '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: Download Workflow Artifact From Deploy All | |
| if: ${{ inputs.cli-deploy-all-workflow-id }} | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: publish-list | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run-id: ${{ inputs.cli-deploy-all-workflow-id }} | |
| - name: Exchange OIDC Token | |
| id: oidc | |
| uses: electron/npm-trusted-auth-action@418d14975a3ff06683cc4580a4eba437f0f017f1 | |
| with: | |
| package-name: "@zowe/${{ env.PKG_NAME }}" | |
| - name: Replace .npmrc | |
| run: | | |
| echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc | |
| echo "omit-lockfile-registry-resolved=true" >> .npmrc | |
| sleep 15 | |
| - name: Deploy Package | |
| id: deploy | |
| run: node scripts/deploy-component.js ${{ env.PKG_NAME }} ${{ env.PKG_TAGS }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: NPM Logout | |
| if: ${{ always() && steps.oidc.outcome == 'success' }} | |
| run: "npm logout" | |
| - name: Create Issue | |
| if: ${{ failure() }} | |
| uses: JasonEtco/create-an-issue@v2 | |
| env: | |
| ERROR_REPORT: ${{ steps.deploy.outputs.errors }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| WORKFLOW_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| with: | |
| filename: .github/deploy-failed.md | |
| update_existing: true |