Skip to content

Update setup.ps1

Update setup.ps1 #291

Workflow file for this run

name: WebApp (JS) - Edge
on:
push:
paths:
- '.github/workflows/webapp-edge.yml'
- 'source/WebApp/**'
- 'source/#external/mirrorsharp/WebAssets/**'
- 'source/#external/mirrorsharp-codemirror-6-preview/WebAssets/**'
pull_request:
workflow_dispatch:
jobs:
build:
name: Build
# https://github.community/t/duplicate-checks-on-push-and-pull-request-simultaneous-event/18012/5
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
permissions:
contents: write
defaults:
run:
working-directory: source/WebApp
steps:
- run: git config --global core.autocrlf false
working-directory: /home
- uses: actions/checkout@v3
with:
submodules: 'true'
lfs: 'true'
- run: git lfs checkout
- uses: actions/setup-node@v3
with:
node-version: '20.14.0'
- run: 'git show ${{ github.sha }} --format="version_number=%cd" --date=format:%Y-%m-%d-%H%M --no-patch >> $GITHUB_OUTPUT'
id: version
- name: Run npm ci (mirrorsharp)
run: npm ci
working-directory: source/#external/mirrorsharp/WebAssets
- name: Run npm run build (mirrorsharp)
run: npm run build
working-directory: source/#external/mirrorsharp/WebAssets
- name: Run npm ci (mirrorsharp-codemirror-6-preview)
run: npm ci
working-directory: source/#external/mirrorsharp-codemirror-6-preview/WebAssets
- name: Run npm run build (mirrorsharp-codemirror-6-preview)
run: npm run build
working-directory: source/#external/mirrorsharp-codemirror-6-preview/WebAssets
- run: npm ci
- run: npm run build-ci
env:
NODE_ENV: production
SHARPLAB_WEBAPP_BUILD_VERSION: ${{ steps.version.outputs.version_number }}
- run: npm run test
- run: npm run build-storybook
env:
NODE_ENV: test
- run: npm run test-storybook
- name: "[Failure] Run actions/upload-artifact@v3 (diff output)"
uses: actions/upload-artifact@v3
if: failure()
with:
name: __diff_output__
path: source/WebApp/app/**/__snapshots__/**/__diff_output__/**/*.*
if-no-files-found: ignore
- name: "[Failure] Run npm run test-storybook-update"
run: npm run test-storybook-update
if: failure()
- name: "[Failure] Run actions/upload-artifact@v3 (updated snapshots)"
uses: actions/upload-artifact@v3
if: failure()
with:
name: '__snapshots__ (updated)'
path: source/WebApp/app/**/__snapshots__/**/*.*
if-no-files-found: ignore
- uses: actions/upload-artifact@v3
with:
name: WebApp
path: source/WebApp/WebApp.zip
if-no-files-found: error
- uses: ncipollo/release-action@b072aaafe138c5ecf1c39f714a76bce6f0d0bc9c
if: github.ref == 'refs/heads/main'
id: create_release
with:
artifacts: ./source/WebApp/WebApp.zip
artifactContentType: application/zip
tag: webapp-release-${{ steps.version.outputs.version_number }}
deploy-to-edge:
name: Deploy (Edge)
needs: build
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feature/execution-flow-output-squashed'
environment: edge-webapp
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: WebApp
- run: Expand-Archive WebApp.zip ./WebApp
shell: pwsh
- run: Rename-Item ./WebApp/latest latest-edge
shell: pwsh
- uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: "Run azure/CLI@e43928ebbc386700c6bb2f42a97a8de31576cfd2: az storage blob upload-batch"
uses: azure/CLI@e43928ebbc386700c6bb2f42a97a8de31576cfd2
with:
azcliversion: 2.30.0
inlineScript: |
az storage blob upload-batch --account-name slpublic -d assets -s WebApp
- run: Invoke-RestMethod -Method POST -Uri 'https://edge.sharplab.io/assets/reload' -Authentication Bearer -Token $(ConvertTo-SecureString $env:SHARPLAB_ASSETS_RELOAD_TOKEN -AsPlainText)
shell: pwsh
env:
SHARPLAB_ASSETS_RELOAD_TOKEN: ${{ secrets.SHARPLAB_ASSETS_RELOAD_TOKEN }}