3

I have recently created a Node.js Web App in Azure.

(This question relates to the Azure environment specifically and is therefore not a duplicate of this question: Github actions for Rust shows Node.js warning (12 - 16). Additionally, that question does not contain a solution to my question).

I associated a GitHub repo with the application when I was prompted to.

This automatically created a folder structure in my repo like this:

.github > workflows > main_myAppName.yml

I assumed that was the 'workflow' which pushes the code to Azure after a git push.

I changed some files in my local repo, added, committed and pushed to GitHub.

I could see the workflow running in GitHub at this URL:

https://github.com/username/repo_name/actions/runs/0123456789

The page displayed this warning:

build
Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: actions/checkout@v2, actions/setup-node@v1, actions/upload-artifact@v2

Because I did not create this 'workflow' file, or have any idea how to use it, I don't know how to resolve this warning.

Question:

  • Should Azure be automatically changing the workflow file so that it is in accordance with GitHub's requirements?

  • Or will I need to monitor changing requirements for 'workflow' files in the future and learn how to apply the required fixes?

To clarify, I am nervous about changing the 'workflow' file because I am not familiar with it and don't want to mess anything up. I was hoping that Azure would just take care of making the required updates to that file.

Below is a screenshot of the warning messages on the build/deployment/actions page.

(For reference, I am using the Free web app tier in order to test the functionality of Azure. I am assuming this is why the build and deployment took over 30 minutes. I also don't know why I am getting a warning about over 10,000 files in this artifact - there are definitely not 10,000 files in my app, and node_modules is, ofcourse, specified in the .gitignore file).

enter image description here

Edit:

Below is the contents of the workflow file at GitHub named:

https://github.com/username/repo_name/blob/main/.github/workflows/main_myAppNameHere.yml

If it is my responsibility to update this file, can anyone please provide guidance on exactly what needs to be changed in it - the workflow file is a completely new concept for me, so I don't understand it.

# 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 - myAppNameHere

on:
  push:
    branches:
      - main
  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, and test
        run: |
          npm install
          npm run build --if-present
          npm run test --if-present

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

  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: 'myAppNameHere'
          slot-name: 'Production'
          publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_SOME-LONG-CODE-HERE }}
          package: .
2
  • github.blog/changelog/… "For Actions users: Update your workflows with latest versions of the actions which runs on Node 16 (Using versions for Actions)" Commented Dec 26, 2022 at 6:02
  • Can you please provide guidance on what needs to be changed in the workflow file in order to make the warning go away - I am reading the docs but I don't understand them. I have added the contents of the workflow file to the question. Commented Dec 26, 2022 at 6:32

1 Answer 1

4

Azure will not update your .yaml workflow file automatically.

You will need to change it yourself.

Each of the actions referenced in the warning message is actually a GitHub Repository, i.e:

https://github.com/actions/checkout
https://github.com/actions/setup-node
https://github.com/actions/upload-artifact

You can see a list of all the actions here:

https://github.com/actions

To resolve the warnings relating to Node.js 12 actions are deprecated:

  • Open your workflow file in your GitHub Repository

enter image description here

  • Change the version number of each action specified in the warning message to v3, ie:
    • actions/checkout@v3
    • actions/setup-node@v3
    • actions/upload-artifact@v3

Although not mentioned in the warnings, this action also has a v3, so you can change that too:

  • actions/download-artifact@v3

Below are some screenshots to provide more context to your question, in case it helps.


I have created NodeJS App and deployed to Azure App Service using GitHub Actions.

My Initial Folder Structure in GitHub enter image description here

Folder Structure After connection to GitHub Actions from Deployment Center

enter image description here

I assumed that was the 'workflow' which pushes the code to Azure after a git push.

  • .github/workflows folder with .yml file will be created when I connect to GitHub from Deployment Center.

There are 2 ways to connect and create Workflows

Way1: Enabling the GitHub Actions while creating the App Service in Azure Portal.

enter image description here

Way 2 : Another way is from Deployment Center => Settings

enter image description here

Should Azure be automatically changing the workflow file so that it is in accordance with GitHub's requirements?

  • Initially, workflow will be generated with the default settings. If we want to make any version changes additionally, need to edit the Workflow manually.

  • Whenever any changes are made in the GitHub Repo, the new build runs in the GitHub Repository.

  • Once after deployment, even I got the same warnings. enter image description here

  • But Iam able to run and view my NodeJS app without any issues. enter image description here

  • I have changed the runtime stack version to NODE 16.

enter image description here

  • Re-run all jobs again. enter image description here

  • I do not find any issues in running the App even I see the warnings.

Sign up to request clarification or add additional context in comments.

8 Comments

Thanks for the information, in my experience, I had to change the version numbers of these actions in the workflow file in my application's GitHub repository: actions/checkout@v2, actions/setup-node@v1, actions/upload-artifact@v2 and actions/download-artifact@v2 to all use v3. And then the warnings about Node.js 12 actions are deprecated went away. (In my app's 'Stack Settings', my Node version was already 18 so I didn't need to change that).
Yes, as per @Lex Li comment, we need to update the versions to v3.I have updated the workflow and able to resolve the warnings.
I have update your answer with the steps required to resolve my initial question and an explanation of why these steps are required. I think the following statement in your answer is incorrect and should be removed, but I will let you do that, as you may have been trying to communicate something else: ...No need to make any changes manually in the workflow, it will be generated automatically based on the changes in the code.
I still think the answer to the question Should Azure be automatically changing the workflow file so that it is in accordance with GitHub's requirements? is No, Azure will not automatically change the workflow file, you will need to manually change it yourself to reference the 'v3' versions of the actions. The workflow will run automatically, however, when any changes are committed and pushed to your repo.
I do agree with you. Will change the points accordingly.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.