最新的更改没有反映在Azure应用服务中,用于使用GitHub操作的react应用程序

ncgqoxb0  于 2023-10-22  发布在  Git
关注(0)|答案(1)|浏览(130)

我在Azure应用服务中使用基本的默认配置,在构建时没有警告和错误。
部署也成功了,但最新的更改没有显示在生产中,仍然显示以前的构建。
这是我用来将构建推送到Azure应用程序服务中的脚本

# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy Node.js app to Azure Web App - AppName

on:
  push:
    branches:
      - stage
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Set up Node.js version
        uses: actions/setup-node@v1
        with:
          node-version: '18.x'

      - name: npm install, build
        run: |
          npm install
          CI=false npm run build-stage

      - name: Create zip archive
        run: zip -r node-app.zip .

      - name: Upload artifact for deployment job
        uses: actions/upload-artifact@v2
        with:
          name: node-app
          path: node-app.zip

  deploy:
    runs-on: ubuntu-latest
    needs: build
    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'
        id: deploy-to-webapp
        uses: azure/webapps-deploy@v2
        with:
          app-name: 'AppName'
          slot-name: 'Production'
          publish-profile: ${{ My profile key }}
          package: .
  • 我已经清除了浏览器中的该高速缓存,也在隐身模式下尝试过。
  • 已重新启动应用程序服务
wlsrxk51

wlsrxk511#

在本地进行任何更改后,请确保使用以下命令将更改推送到Github存储库:

git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin "git repository link"
git push -u origin main -f

#Now after making some changes in your local code or file you can add git add "file-name" or git add . to add entire directory again. 

git init
git add "file-name"
git commit -m "second commit"
git branch -M main
#Check for the remote git repository URL
git remote -v
 
#Push the changes 
git push -u origin main -f

在Repository中推送更改后,* 您可以在Deployment Center中单击Sync button,重新运行工作流,如下所示:-*

您也可以在Github操作标签重新运行Deployment,如下所示:

请参考我的SO线程答案通过Github操作成功部署React应用

相关问题