Refactor Azure deployment workflow to use ZIP package #26
This file contains hidden or 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://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 - blissMe | |
| on: | |
| push: | |
| branches: | |
| - Azure | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20.x' | |
| - name: Install dependencies and build | |
| run: | | |
| npm install | |
| npm run build --if-present | |
| - name: Prepare deployment package | |
| run: | | |
| # Adjust 'dist' to your build output folder if different | |
| mkdir -p deploy | |
| cp -r package.json package-lock.json dist deploy/ | |
| cd deploy | |
| zip -r ../app.zip . | |
| cd .. | |
| - name: Upload deployment artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: node-app | |
| path: app.zip | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: node-app | |
| - name: Login to Azure | |
| uses: azure/login@v2 | |
| with: | |
| client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_F2690FC62C8D4F98922A6703D58C5F04 }} | |
| tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_8EF739A0245B4CF984C652DF31692E6B }} | |
| subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_624F2E55EB66465DAC3DAAF853BF1586 }} | |
| - name: Deploy ZIP to Azure Web App | |
| uses: azure/webapps-deploy@v3 | |
| with: | |
| app-name: 'blissMe' | |
| slot-name: 'Production' | |
| package: app.zip | |