Zowe CLI Deploy All #723
This file contains 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 All | |
on: | |
schedule: | |
- cron: '0 2 * * *' | |
workflow_dispatch: | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
deploy-matrix: ${{ steps.matrix.outputs.deploy-matrix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use Node.js LTS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 'lts/*' | |
cache: ${{ (!env.ACT && 'npm') || '' }} | |
- name: Install Dependencies | |
run: npm ci | |
- name: Get Package Matrix | |
id: matrix | |
run: node scripts/get-package-matrix.js | |
deploy: | |
needs: setup | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
max-parallel: 1 | |
matrix: | |
package: ${{ fromJson(needs.setup.outputs.deploy-matrix) }} | |
steps: | |
- name: Set Environment Variables | |
run: | | |
read -r PKG_NAME PKG_TAGS <<< "${{ matrix.package }}" | |
echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_ENV | |
echo "PKG_TAGS=${PKG_TAGS}" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use Node.js LTS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 'lts/*' | |
cache: ${{ (!env.ACT && 'npm') || '' }} | |
- name: Install Dependencies | |
run: npm ci | |
- name: NPM Login | |
run: bash scripts/npm_login.sh ${{ env.NPM_REGISTRY || 'https://registry.npmjs.org/' }} | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_PUBLIC_TOKEN }} | |
- name: Deploy Package | |
id: deploy | |
run: node scripts/deploy-component.js ${{ env.PKG_NAME }} ${{ env.PKG_TAGS }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- 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 | |
- name: Close Issue | |
if: ${{ success() }} | |
uses: lee-dohm/close-matching-issues@v2 | |
with: | |
query: '"Failed to deploy @zowe/${{ env.PKG_NAME }}" in:title' | |
token: ${{ secrets.GITHUB_TOKEN }} |