Update ZeroTrustTemplate.xlsx #118
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: Web App - GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened, closed] | |
branches: | |
- main | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
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@v3 | |
with: | |
submodules: true | |
- name: Update API endpoint for environment | |
shell: pwsh | |
run: | | |
$apiEndPoint = 'https://ztassess.azurewebsites.net' | |
$clientId = 'df2798fc-2aed-4c3a-98ae-1776949480c4' | |
$envName = '' | |
$configFilePath = './src/reactapp/src/authConfig.js' | |
$config = Get-Content $configFilePath | |
$config = $config -replace "^.*apiEndPoint.*$", " apiEndPoint: '$apiEndPoint'" | |
$config = $config -replace "^.*clientId.*$", " clientId: '$clientId'" | |
$config = $config -replace "^.*envName.*$", " envName: '$envName'" | |
Set-Content -Value $config -Path $configFilePath | |
Write-Output "Updating $configFilePath to -->" | |
Write-Output $config | |
$appjsPath = './src/reactapp/src/App.js' | |
$appjs = Get-Content $appjsPath | |
$appjs = $appjs -replace '<BrowserRouter>', '<BrowserRouter basename="/zerotrustassessment" >' | |
Set-Content -Value $appjs -Path $appjsPath | |
Write-Output "Updating $appjsPath to -->" | |
Write-Output $appjs | |
- name: Setup Node 16.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
cache: npm | |
- name: Install dependencies | |
working-directory: ./src/reactapp/src | |
run: | | |
npm install | |
npm run build | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./src/reactapp/build | |
# - name: Setup Pages | |
# uses: actions/configure-pages@v3 | |
# - name: Upload artifact | |
# uses: actions/upload-pages-artifact@v1 | |
# with: | |
# name: reactapp | |
# path: './src/reactapp/build' | |
# - name: Deploy to GitHub Pages | |
# id: github-pages | |
# uses: actions/deploy-pages@v2 | |
# with: | |
# artifact_name: reactapp |