diff --git a/.github/workflows/node-nuxtjs-on-azure-app-service-with-zip.yml b/.github/workflows/node-nuxtjs-on-azure-app-service-with-zip.yml index 9eb09df..d4a51cb 100644 --- a/.github/workflows/node-nuxtjs-on-azure-app-service-with-zip.yml +++ b/.github/workflows/node-nuxtjs-on-azure-app-service-with-zip.yml @@ -8,26 +8,27 @@ on: workflow_dispatch: env: - NODE_VERSION: '16.x' WORKING_DIRECTORY: nodejs/nuxtjs PACKAGE_NAME: node-app ARCHIVE_NAME: nuxtjs.zip +permissions: + id-token: write + contents: read + jobs: build-nuxtjs-zip: runs-on: ubuntu-latest - defaults: run: working-directory: ${{ env.WORKING_DIRECTORY }} - steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: - node-version: ${{ env.NODE_VERSION }} + node-version: '16.x' cache: 'npm' cache-dependency-path: ${{ env.WORKING_DIRECTORY }} @@ -45,7 +46,7 @@ jobs: working-directory: ${{ env.WORKING_DIRECTORY }} - name: Upload artifact for deployment job - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: ${{ env.PACKAGE_NAME }} path: ${{ env.WORKING_DIRECTORY }}/${{ env.ARCHIVE_NAME }} @@ -56,18 +57,26 @@ jobs: environment: name: 'Production' url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} - steps: - name: Download artifact from build job - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: ${{ env.PACKAGE_NAME }} - - name: 'Deploy to Azure Web App' + - name: Az CLI Login + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + + - name: 'Run Azure webapp deploy action' id: deploy-to-webapp - uses: azure/webapps-deploy@v2 + uses: azure/webapps-deploy@v3 with: - app-name: ${{ vars.AZURE_WEBAPP_NAME }} + app-name: ${{ vars.AZURE_WEBAPP_NAME }}-nuxtjs slot-name: 'Production' - publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} package: ${{ env.ARCHIVE_NAME }} + + - name: Az CLI Logout + run: az logout diff --git a/.github/workflows/node-nuxtjs-on-azure-app-service.yml b/.github/workflows/node-nuxtjs-on-azure-app-service.yml index e63bbfd..4674b7b 100644 --- a/.github/workflows/node-nuxtjs-on-azure-app-service.yml +++ b/.github/workflows/node-nuxtjs-on-azure-app-service.yml @@ -8,25 +8,26 @@ on: workflow_dispatch: env: - NODE_VERSION: '16.x' WORKING_DIRECTORY: nodejs/nuxtjs PACKAGE_NAME: node-app +permissions: + id-token: write + contents: read + jobs: build-nuxtjs: runs-on: ubuntu-latest - defaults: run: working-directory: ${{ env.WORKING_DIRECTORY }} - steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: - node-version: ${{ env.NODE_VERSION }} + node-version: '16.x' cache: 'npm' cache-dependency-path: ${{ env.WORKING_DIRECTORY }} @@ -37,7 +38,7 @@ jobs: npm run test --if-present - name: Upload artifact for deployment job - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: ${{ env.PACKAGE_NAME }} path: ${{ env.WORKING_DIRECTORY }} @@ -48,18 +49,26 @@ jobs: environment: name: 'Production' url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} - steps: - name: Download artifact from build job - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: ${{ env.PACKAGE_NAME }} - - name: 'Deploy to Azure Web App' + - name: Az CLI Login + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + + - name: 'Run Azure webapp deploy action' id: deploy-to-webapp - uses: azure/webapps-deploy@v2 + uses: azure/webapps-deploy@v3 with: - app-name: ${{ vars.AZURE_WEBAPP_NAME }} + app-name: ${{ vars.AZURE_WEBAPP_NAME }}-nuxtjs slot-name: 'Production' - publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} - package: . + package: ${{ env.ARCHIVE_NAME }} + + - name: Az CLI Logout + run: az logout