Update NewActionWorkflow.yml #11
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
on: | |
push: | |
branches: | |
- feature | |
pull_request: | |
branches: | |
- main | |
- develop | |
env: | |
NODE_VERSION: '16.x' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'npm' | |
- name: npm install, build and test | |
run: | | |
npm install | |
npm run build --if-present | |
npm run test --if-present | |
- name: Upload artifact for deployment | |
uses: actions/upload-artifact@v3 | |
with: | |
name: node-app | |
path: . | |
deploy-to-test: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.event_name == 'pull_request' && github.base_ref == 'refs/heads/develop' | |
environment: | |
name: 'test' | |
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
steps: | |
- name: Download artifact from build job | |
uses: actions/download-artifact@v2 | |
with: | |
name: node-app | |
- name: 'Deploy to Azure Web App Test (L5-M3-Test)' | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: 'L5-M3-Test' | |
slot-name: 'Test' | |
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_8E171E9ED47D41E49585227E738F3014 }} | |
package: . | |
deploy-to-production: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main' | |
environment: | |
name: 'production' | |
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
steps: | |
- name: Download artifact from build job | |
uses: actions/download-artifact@v2 | |
with: | |
name: node-app | |
- name: 'Deploy to Azure Web App Production (L5-M3-2)' | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: 'L5-M3-2' | |
slot-name: 'Production' | |
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_0694010A467345BC83A7673AB4B541DA }} | |
package: . |