Created
January 28, 2022 14:13
-
-
Save dgusoff/9844c82f850e4d75c8d6e95c6557fc7e to your computer and use it in GitHub Desktop.
deploy CRA to Azure
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 is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the action will run. | |
on: | |
push: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
AZURE_WEBAPP_PACKAGE_PATH: './build' # set this to the path to your web app project, defaults to the repository root | |
NODE_VERSION: '14.16' # set this to the node version to use | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
build-and-deploy: | |
name: Build and Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: npm install, build, and test | |
run: | | |
cat .env.example | sed 's#{{client_id}}#${{secrets.AZURE_CLIENT_ID}}#g' | sed 's#{{tenant_id}}#${{secrets.AZURE_TENANT_ID}}#g' | sed 's#{{redirect_url}}#${{secrets.AZURE_REDIRECT_URL}}#g' > .env | |
npm install | |
npm run build --if-present | |
npm run test --if-present | |
- name: 'Deploy to Azure WebApp' | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{ secrets.AZURE_WEBAPP_NAME }} | |
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment