Skip to content

cscheffauer is running Deploy Package CD #337

cscheffauer is running Deploy Package CD

cscheffauer is running Deploy Package CD #337

name: Deploy Package CD
run-name: ${{ github.actor }} is running Deploy Package CD
on:
push:
branches:
- main
workflow_dispatch:
env:
rid: ${{ github.run_id }}-${{ github.run_number }}
jobs:
initialize:
name: Initialize
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3.7.0
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- name: Validate Dependencies
id: validate-dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: node-modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
if: steps.validate-dependencies.outputs.cache-hit != 'true'
run: yarn
- name: Cache Dependencies
uses: actions/cache@v3
if: steps.validate-dependencies.outputs.cache-hit != 'true'
with:
path: '**/node_modules'
key: node-modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
build-automation:
name: Build Automation
needs: initialize
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3.7.0
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- name: Uncache Dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: node-modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Synchronize Packages
run: yarn
- name: Build Automation
run: yarn telemetry build && yarn automation build:cli
- name: Cache Automation
uses: actions/cache@v3
with:
path: '**/automation/dist'
key: automation-dist-${{ runner.os }}-${{ env.rid }}
generate-package-matrix:
name: Generate Package Matrix
needs: build-automation
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.generate-package-matrix.outputs.packages }}
steps:
- name: Checkout Project
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3.7.0
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- name: Uncache Dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: node-modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Uncache Automation
uses: actions/cache@v3
with:
path: '**/automation/dist'
key: automation-dist-${{ runner.os }}-${{ env.rid }}
- name: Synchronize Packages
run: yarn
- name: Update Main Branch
run: |
git fetch origin main --unshallow
- id: generate-package-matrix
name: Generate Package Matrix
run: echo "packages=$(yarn md-automation -- --command get-packages --changed --commit-index 1 --dependent)" >> $GITHUB_OUTPUT
- name: Display Package Matrix
run: echo "generated package matrix - ${{ steps.generate-package-matrix.outputs.packages }}"
build:
name: Build
needs: initialize
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3.7.0
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- name: Uncache Dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: node-modules-next-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Synchronize Packages
run: yarn
- name: Build
run: yarn build
- name: Cache Dist
uses: actions/cache@v3
with:
path: '**/dist'
key: dist-${{ runner.os }}-${{ env.rid }}
deploy-npmjs:
name: ( ${{ matrix.package }} ) Deploy - NPMJS
needs: [build, generate-package-matrix]
runs-on: ubuntu-latest
strategy:
matrix:
package: ${{ fromJson(needs.generate-package-matrix.outputs.packages) }}
steps:
- name: Checkout Project
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3.7.0
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- name: Uncache Dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: node-modules-next-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Uncache Dist
uses: actions/cache@v3
with:
path: '**/dist'
key: dist-${{ runner.os }}-${{ env.rid }}
- name: Synchronize Packages
run: yarn
- name: Update Main Branch
run: |
git fetch origin main --unshallow
- name: Increment Packages
run: yarn md-automation -- --command increment-packages --packages ${{ matrix.package }}
- name: Configure Yarn
run: yarn config set npmAuthToken ${{ secrets.NPM_TOKEN_CISCO_MD }}
- name: ( ${{ matrix.package }} ) Deploy - NPMJS
run: yarn workspace ${{ matrix.package }} publish:npmjs
dispatch-telemetry:
name: ( ${{ matrix.package }} ) Dispatch Telemetry
needs: [deploy-npmjs, generate-package-matrix]
runs-on: ubuntu-latest
strategy:
matrix:
package: ${{ fromJson(needs.generate-package-matrix.outputs.packages) }}
steps:
- name: Checkout Project
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3.7.0
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- name: Uncache Dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: node-modules-next-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Uncache Dist
uses: actions/cache@v3
with:
path: '**/dist'
key: dist-${{ runner.os }}-${{ env.rid }}
- name: Synchronize Packages
run: yarn
- name: Update Main Branch
run: |
git fetch origin main --unshallow
- name: Dispatch Telemetry ( ${{ matrix.package }} )
run: yarn md-automation -- --command dispatch-telemetry --packages ${{ matrix.package }}
env:
MOMENTUM_METRICS_API_KEY: ${{ secrets.MOMENTUM_METRICS_API_KEY }}
create-release:
name: ( ${{ matrix.package }} ) Create Release
needs: [deploy-npmjs, generate-package-matrix]
runs-on: ubuntu-latest
strategy:
matrix:
package: ${{ fromJson(needs.generate-package-matrix.outputs.packages) }}
steps:
- name: Checkout Project
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3.7.0
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- name: Uncache Dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: node-modules-next-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Uncache Dist
uses: actions/cache@v3
with:
path: '**/dist'
key: dist-${{ runner.os }}-${{ env.rid }}
- name: Synchronize Packages
run: yarn
- name: Update Main Branch
run: git fetch origin main --unshallow
- name: Create Release ( ${{ matrix.package }} )
run: yarn md-automation -- --command create-release --packages ${{ matrix.package }} --since origin/main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}