Merge pull request #22 from Yiyis/refresh #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
# Docs for the Azure Web Apps Deploy action: https://go.microsoft.com/fwlink/?linkid=2134798 | |
# More GitHub Actions for Azure: https://go.microsoft.com/fwlink/?linkid=2135048 | |
on: | |
push: | |
branches: | |
- master | |
env: | |
AZURE_WEBAPP_NAME: YiyiShao # set this to your application's name | |
AZURE_WEBAPP_PACKAGE_PATH: 'build' # set this to the path to your web app project, defaults to the repository root | |
NODE_VERSION: '12.x' # set this to the node version to use | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# checkout the repo | |
- name: 'Checkout Github Action' | |
uses: actions/checkout@master | |
- name: Set up Node.js version | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: npm install, build | |
run: | | |
npm install | |
npm run build --if-present | |
- name: add process.json | |
run: | | |
echo '{ script: "serve", env: { PM2_SERVE_SPA: "true", PM2_SERVE_HOMEPAGE: "/index.html" } }' >> build/process.json | |
- name: Run Azure webapp deploy action using publish profile credentials | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
slot-name: Production | |
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} | |