Merge pull request #243 from hermanarnedo/patch-31 #876
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 = 'e7dfcbb6-fe86-44a2-b512-8d361dcc3d30' | |
$envName = '' | |
$configFilePath = './src/react/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 | |
- name: Setup Node 16.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
cache: npm | |
- name: Install dependencies | |
working-directory: ./src/react/src | |
run: | | |
npm install | |
npm run build | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./src/react/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 |