Bump word-wrap from 1.2.3 to 1.2.4 in /packages/app #290
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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
# Workflow syntax reference: | |
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions | |
name: CI | |
on: | |
# Deploys with overwrite as current package.json version to main deploy | |
# New versions are deployed with `deploy` build | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
# release: | |
# types: [published] | |
env: | |
# This is used by the SharedProps to detect a PR build | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
APP_CONSTRUCT_FOLDER_NAME: microapps-app-release | |
APP_NAME: release | |
APP_PACKAGE_NAME: '@pwrdrvr/microapps-app-release' | |
ENV: prod | |
DEPLOYER_LAMBDA_NAME: microapps-core-ghpublic-deployer-prod | |
AWS_REGION: us-east-2 | |
CDK_CONTEXT_ARGS: "--context @pwrdrvr/microapps:tableName=microapps-core-ghpublic-prod" | |
jobs: | |
version: | |
uses: ./.github/workflows/r_version.yml | |
with: | |
APP_PACKAGE_NAME: '@pwrdrvr/microapps-app-release' | |
build: | |
needs: | |
- version | |
uses: ./.github/workflows/r_build-app.yml | |
with: | |
APP_NAME: release | |
APP_PACKAGE_NAME: '@pwrdrvr/microapps-app-release' | |
APP_CONSTRUCT_FOLDER_NAME: microapps-app-release | |
packageVersion: ${{ needs.version.outputs.packageVersion }} | |
prSuffix: ${{ needs.version.outputs.prSuffix }} | |
build-storybook: | |
needs: | |
- version | |
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'BUILD-STORYBOOK')) | |
permissions: | |
contents: read | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Cache Node Modules | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
packages/**/node_modules | |
key: node-modules-${{ hashFiles('package.json', 'package-lock.json', 'patches/*') }} | |
- name: Optionally Install Node Modules | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Dump info from version reusable workflow | |
run: | | |
echo "packageVersion: ${{ needs.version.outputs.packageVersion }}" | |
echo "prSuffix: ${{ needs.version.outputs.prSuffix }}" | |
- name: Apply NPM Version to Everything | |
run: | | |
npm version ${{ needs.version.outputs.packageVersion }} \ | |
--no-git-tag-version --allow-same-version | |
npm version ${{ needs.version.outputs.packageVersion }} \ | |
--no-git-tag-version --allow-same-version --workspaces | |
- name: Build Story Book | |
run: | | |
npm run -w ${APP_PACKAGE_NAME} build:storybook | |
# Upload Artifact | |
- name: Zip Package | |
working-directory: packages/app/ | |
run: zip -r storybook-static.zip storybook-static | |
- name: Upload Zip | |
uses: actions/upload-artifact@v3 | |
with: | |
name: storybook_zip | |
path: packages/app/storybook-static.zip | |
deploy-storybook: | |
if: github.actor != 'dependabot[bot]' | |
needs: | |
- version | |
- build-storybook | |
concurrency: | |
group: deploy-storybook-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.pull_request.number) || github.head_ref }} | |
cancel-in-progress: false | |
permissions: | |
contents: read | |
id-token: write | |
statuses: write | |
runs-on: ubuntu-latest | |
environment: | |
name: ghpublic | |
url: https://apps.ghpublic.pwrdrvr.com/${{ env.APP_NAME }}-storybook/${{ needs.version.outputs.packageVersion }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Cache Node Modules | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
packages/**/node_modules | |
key: node-modules-${{ hashFiles('package.json', 'package-lock.json', 'patches/*') }} | |
- name: Optionally Install Node Modules | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Download Artifact - Story Book | |
uses: actions/download-artifact@v3 | |
with: | |
name: storybook_zip | |
path: packages/app/ | |
- name: Unzip Artifact - Story Book | |
working-directory: packages/app/ | |
run: unzip storybook-static.zip | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
role-session-name: microapps-app-${{ env.APP_NAME }}-build | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/builder-writeRole | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Preflight Check Version - Story Book | |
run: | | |
npx microapps-publish preflight \ | |
--app-name ${APP_NAME}-storybook \ | |
--new-version ${{ needs.version.outputs.packageVersion }} \ | |
--deployer-lambda-name ${DEPLOYER_LAMBDA_NAME} \ | |
--overwrite | |
- name: Publish MicroApps - Story Book | |
run: | | |
npx microapps-publish publish-static \ | |
--app-name ${APP_NAME}-storybook \ | |
--new-version ${{ needs.version.outputs.packageVersion }} \ | |
--deployer-lambda-name ${DEPLOYER_LAMBDA_NAME} \ | |
--static-assets-path packages/app/storybook-static \ | |
--default-file index.html \ | |
--overwrite \ | |
--no-cache | |
- name: App URL | |
uses: Sibz/github-status-action@v1 | |
with: | |
authToken: ${{secrets.GITHUB_TOKEN}} | |
context: 'Storybook URL' | |
description: 'Passed' | |
state: 'success' | |
sha: ${{github.event.pull_request.head.sha || github.sha}} | |
target_url: https://apps.ghpublic.pwrdrvr.com/${{ env.APP_NAME }}-storybook/${{ needs.version.outputs.packageVersion }} | |
deploy-ghpublic: | |
if: github.actor != 'dependabot[bot]' | |
needs: | |
- version | |
- build | |
concurrency: | |
group: deploy-app-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.pull_request.number) || github.head_ref }} | |
cancel-in-progress: false | |
permissions: | |
contents: read | |
id-token: write | |
statuses: write | |
runs-on: ubuntu-latest | |
environment: | |
name: ghpublic | |
url: https://apps.ghpublic.pwrdrvr.com/${{ env.APP_NAME }}?appver=${{ needs.version.outputs.packageVersion }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Cache Node Modules | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
packages/**/node_modules | |
key: node-modules-${{ hashFiles('package.json', 'package-lock.json', 'patches/*') }} | |
- name: Optionally Install Node Modules | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: npm ci | |
# Fixes errors due to JSII tsconfig.json not ignoring libs | |
# node_modules/flatpickr/dist/types/instance.d.ts(37,21): error TS2304: Cannot find name 'Node'. | |
# Error: node_modules/flatpickr/dist/types/instance.d.ts(82,56): error TS2304: Cannot find name 'HTMLElementTagNameMap'. | |
# Error: node_modules/@types/carbon-components-react/lib/components/FileUploader/FileUploaderDropContainer.d.ts(46,80): error TS2304: Cannot find name 'File'. | |
# Error: node_modules/@types/overlayscrollbars/index.d.ts(348,19): error TS2304: Cannot find name 'NodeListOf'. | |
- name: Modify cdk-construct tsconfig.json | |
run: | | |
mv ./packages/cdk-construct/tsconfig.json ./packages/cdk-construct/tsconfig.jsii.json | |
jq ".compilerOptions += { \"skipLibCheck\": true }" ./packages/cdk-construct/tsconfig.jsii.json > ./packages/cdk-construct/tsconfig.json | |
# Applying the version allows us to use the version in the CDK construct | |
- name: Apply NPM Version to Everything | |
run: | | |
npm version ${{ needs.version.outputs.packageVersion }} \ | |
--no-git-tag-version --allow-same-version | |
npm version ${{ needs.version.outputs.packageVersion }} \ | |
--no-git-tag-version --allow-same-version --workspaces | |
- name: Build All TypeScript | |
run: npm run build | |
- name: Download Artifact - App | |
uses: actions/download-artifact@v3 | |
with: | |
name: app_zip | |
path: packages/cdk-construct/lib/ | |
- name: Unzip Artifact - App | |
working-directory: packages/cdk-construct/lib/ | |
run: unzip -o nextjs.zip | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
role-session-name: microapps-app-${{ env.APP_NAME }}-build | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/builder-writeRole | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Preflight Check Version - App | |
run: | | |
npx microapps-publish preflight \ | |
--app-name ${APP_NAME} \ | |
--new-version ${{ needs.version.outputs.packageVersion }} \ | |
--deployer-lambda-name ${DEPLOYER_LAMBDA_NAME} \ | |
--overwrite | |
- name: Set Hotswap Flag | |
run: | | |
if [ -n "${PR_NUMBER}" ]; then | |
echo "HOTSWAP_FLAG=--hotswap-fallback" >> $GITHUB_ENV | |
else | |
echo "HOTSWAP_FLAG=" >> $GITHUB_ENV | |
fi | |
- name: Deploy CDK Stack - App | |
run: | | |
npx cdk deploy ${CDK_CONTEXT_ARGS} ${HOTSWAP_FLAG} \ | |
--require-approval never app | |
- name: Publish to MicroApps - App | |
run: | | |
npx microapps-publish publish \ | |
--app-name ${APP_NAME} \ | |
--type lambda-url \ | |
--startup-type direct \ | |
--new-version ${{ needs.version.outputs.packageVersion }} \ | |
--deployer-lambda-name ${DEPLOYER_LAMBDA_NAME} \ | |
--app-lambda-name microapps-app-${APP_NAME}-${ENV}${{ needs.version.outputs.prSuffix }} \ | |
--static-assets-path packages/cdk-construct/lib/${APP_CONSTRUCT_FOLDER_NAME}/static_files \ | |
--overwrite | |
- name: App URL | |
uses: Sibz/github-status-action@v1 | |
with: | |
authToken: ${{secrets.GITHUB_TOKEN}} | |
context: 'App URL' | |
description: 'Passed' | |
state: 'success' | |
sha: ${{github.event.pull_request.head.sha || github.sha}} | |
target_url: https://apps.ghpublic.pwrdrvr.com/${{ env.APP_NAME }}?appver=${{ needs.version.outputs.packageVersion }} | |
- name: Test App | |
run: | | |
echo Testing App HTML Loading | |
curl -H"accept: text/html" --fail https://apps.ghpublic.pwrdrvr.com/${{ env.APP_NAME }}?appver=${{ needs.version.outputs.packageVersion }} | |
echo "\nTesting App Method Invocation" | |
curl -H"accept: application/json" --fail https://apps.ghpublic.pwrdrvr.com/${{ env.APP_NAME }}/${{ needs.version.outputs.packageVersion }}/api/refresh/${{ env.APP_NAME }} |