add useMatomo hook so we can use this in all apps moving forward #75
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: CI - lab&icons | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- "packages/react-components-lab/**" | |
- "packages/icons/**" | |
pull_request: | |
types: [opened, synchronize, reopened, closed] | |
branches: | |
- master | |
paths: | |
- "packages/react-components-lab/**" | |
- "packages/icons/**" | |
jobs: | |
build_and_deploy_job: | |
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') | |
runs-on: ubuntu-latest | |
name: Build and Deploy Job | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Use Node 16 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://npm.pkg.github.com/' | |
scope: '@dhi' | |
- name: Add GITHUB_TOKEN to .npmrc | |
run: | | |
cd packages/react-components-lab | |
echo "@dhi:registry=https://npm.pkg.github.com" >> .npmrc | |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc | |
- name: Use cached node_modules | |
id: cache-modules | |
uses: actions/cache@v2 | |
with: | |
path: .yarn/cache/ | |
key: yarnCache-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
yarnCache- | |
- name: Install dependencies without cache | |
if: steps.cache-modules.outputs.cache-hit != 'true' | |
run: | | |
yarn install --immutable | |
env: | |
CI: true | |
- name: Install dependencies with cache | |
if: steps.cache-modules.outputs.cache-hit == 'true' | |
run: | | |
yarn install --immutable-cache | |
env: | |
CI: true | |
- name: Build app | |
run: yarn run lab:build-storybook | |
env: | |
CI: true | |
- name: Lint | |
run: cd packages/react-components-lab && yarn run lint | |
env: | |
CI: true | |
- name: Build lab package | |
run: cd packages/react-components-lab && yarn build | |
env: | |
CI: true | |
- name: Build And Deploy | |
if: (github.ref != 'master' && ${{ failure() }}) || ${{ success() }} | |
id: builddeploy | |
uses: Azure/static-web-apps-deploy@v1 | |
with: | |
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_TOKEN }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) | |
action: "upload" | |
###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### | |
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig | |
app_location: "./packages/react-components-lab/storybook-static" # App source code path | |
api_location: "" # Api source code path - optional | |
output_location: "storybook-static" # Built app content directory - optional | |
app_build_command: "yarn build-storybook" | |
skip_app_build: true | |
###### End of Repository/Build Configurations ###### | |
close_pull_request_job: | |
if: github.event_name == 'pull_request' && github.event.action == 'closed' | |
runs-on: ubuntu-latest | |
name: Close Pull Request Job | |
steps: | |
- name: Close Pull Request | |
id: closepullrequest | |
uses: Azure/static-web-apps-deploy@v1 | |
with: | |
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_TOKEN }} | |
action: "close" |