Skip to content

Commit

Permalink
Merge pull request #8 from Waterclone/main
Browse files Browse the repository at this point in the history
main to develop
  • Loading branch information
Waterclone committed Aug 30, 2023
2 parents b0af9f0 + 372c70d commit 173e527
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/NewActionWorkflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
on:
push:
branches:
- feature
pull_request:
branches:
- main
- develop

env:
AZURE_WEBAPP_NAME: L5-M3-Test
AZURE_WEBAPP_NAME2: L5-M3-2
AZURE_WEBAPP_PACKAGE_PATH: '.'
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: 'production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: node-app

- name: 'Deploy to Azure Webapp Test (L5-M3-Test)'
id: deploy-to-webapp
uses: azure/webapps-deploy@85270a1854658d167ab239bce43949edb336fa7c
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

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@v3
with:
name: node-app

- name: 'Deploy to Azure Webapp Production (L5-M3-2)'
id: deploy-to-webapp
uses: azure/webapps-deploy@85270a1854658d167ab239bce43949edb336fa7c
with:
app-name: ${{ env.AZURE_WEBAPP_NAME2 }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

0 comments on commit 173e527

Please sign in to comment.