From 8dac01781eb780017a3b0a6b321955395b41baea Mon Sep 17 00:00:00 2001 From: Yohan Lasorsa Date: Mon, 22 Jul 2024 07:38:16 +0000 Subject: [PATCH] feat: update workflows and use Node 20 --- .github/workflows/deploy.yml | 16 ++++++++-------- .github/workflows/packages.yml | 4 ++-- .github/workflows/template.yml | 2 +- README.md | 2 +- docs/workshop.md | 20 ++++++++++---------- docs/workshop.pt-br.md | 20 ++++++++++---------- package.json | 4 ++-- 7 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 70d4596..79b9113 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,4 @@ -# This workflow for our node.js 18 app does the following: +# This workflow for our node.js 20 app does the following: # - run tests # - build the app # - login to Azure with AZURE_CREDENTIALS github secret @@ -15,11 +15,11 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Use Node.js 18 - uses: actions/setup-node@v2 + - uses: actions/checkout@v4 + - name: Use Node.js 20 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: Install dependencies run: npm ci - name: Run tests @@ -27,7 +27,7 @@ jobs: - name: Build run: npm run build - name: Login to Azure - uses: azure/login@v1 + uses: azure/login@v2 with: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Deploy to Azure @@ -39,8 +39,8 @@ jobs: # Create database todos with collection tasks az cosmosdb sql database create --account-name copilot-nodejs-todo --resource-group rg-copilot-nodejs-todo --name todos az cosmosdb sql container create --account-name copilot-nodejs-todo --resource-group rg-copilot-nodejs-todo --database-name todos --name tasks --partition-key-path /_partitionKey --throughput 400 - # Deploy webapp using node 18 - az webapp up --sku F1 --name nodejs-todo-sinedied --resource-group rg-copilot-nodejs-todo --runtime "node|18-lts" + # Deploy webapp using node 20 + az webapp up --sku F1 --name nodejs-todo-sinedied --resource-group rg-copilot-nodejs-todo --runtime "node|20-lts" # Retrieve cosmos endpoint cosmos_endpoint=$(az cosmosdb show --name copilot-nodejs-todo --resource-group rg-copilot-nodejs-todo --query documentEndpoint --output tsv) # Retrieve cosmos key diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 434cfbd..0fe3be8 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -12,11 +12,11 @@ jobs: contents: write steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Create packages run: ./scripts/create-packages.sh - name: Update release - uses: ncipollo/release-action@v1.12.0 + uses: ncipollo/release-action@v1.14.0 with: name: Workshop packages tag: latest diff --git a/.github/workflows/template.yml b/.github/workflows/template.yml index ccef83a..2b40bf6 100644 --- a/.github/workflows/template.yml +++ b/.github/workflows/template.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Update template run: | git config --global user.name "sinedied" diff --git a/README.md b/README.md index 25f1344..d8f11c5 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Discover how to use GitHub Copilot to quickly build a Node.js application with A 👉 [See the workshop](https://aka.ms/ws/copilot-todo) ## Prerequisites -- Node.js v18+ +- Node.js v20+ - An Azure account ([sign up for free here](https://azure.microsoft.com/free/?WT.mc_id=javascript-0000-yolasors)) You can use [GitHub Codespaces](https://github.com/features/codespaces) to work on this project directly from your browser: select the **Code** button, then the **Codespaces** tab and click on **Create Codespaces on main**. diff --git a/docs/workshop.md b/docs/workshop.md index 4a51e9f..c0b3c77 100644 --- a/docs/workshop.md +++ b/docs/workshop.md @@ -117,7 +117,7 @@ If you want to work locally without using a dev container, you need to clone the | | | |---------------|--------------------------------| | Git | [Get Git](https://git-scm.com) | -| Node.js v18+ | [Get Node.js](https://nodejs.org) | +| Node.js v20+ | [Get Node.js](https://nodejs.org) | | Azure CLI | [Get Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli#install) | | GitHub CLI | [Get GitHub CLI](https://cli.github.com/manual/installation) | | Bash v3+ | [Get bash](https://www.gnu.org/software/bash/) (Windows users can use **Git bash** that comes with Git) | @@ -886,7 +886,7 @@ This file will contain the instructions for our CI/CD pipeline. Create a new file in your repository with the path `.github/workflows/deploy.yml` and add the following content: ```yml -# This workflow for our node.js 18 app does the following: +# This workflow for our node.js 20 app does the following: # - run tests # - build the app # - login to Azure with AZURE_CREDENTIALS github secret @@ -896,7 +896,7 @@ Create a new file in your repository with the path `.github/workflows/deploy.yml After you hit `enter`, Copilot might be tempted to complete the comments, but that's not what we want to ignore it if that's the case by hitting `enter` again. It should not starts to complete the workflow, continue accepting suggestion until you end up with something like this: ```yaml -# This workflow for our node.js 18 app does the following: +# This workflow for our node.js 20 app does the following: # - run tests # - build the app # - login to Azure with AZURE_CREDENTIALS github secret @@ -913,11 +913,11 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Use Node.js 18 - uses: actions/setup-node@v2 + - uses: actions/checkout@v4 + - name: Use Node.js 20 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: Install dependencies run: npm ci - name: Run tests @@ -925,7 +925,7 @@ jobs: - name: Build run: npm run build - name: Login to Azure - uses: azure/login@v1 + uses: azure/login@v2 with: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Deploy to Azure @@ -988,13 +988,13 @@ As you can see, it's very subtle and the `--name` option have different meanings Let's continue by adding this comment: ```bash -# Deploy webapp using node 18 +# Deploy webapp using node 20 ``` Now it you suggest a command similar than what it did in the first place: ```bash -az webapp up --sku F1 --name copilot-nodejs-todo --resource-group rg-copilot-nodejs-todo --runtime "node|18-lts" +az webapp up --sku F1 --name copilot-nodejs-todo --resource-group rg-copilot-nodejs-todo --runtime "node|20-lts" ``` Again, accept it, but we'll need to tweak the `--name` option a bit to make it unique, as it will also serve as the URL for your web app. Change it to something like `--name nodejs-todo-YOUR_GITHUB_USERNAME`. diff --git a/docs/workshop.pt-br.md b/docs/workshop.pt-br.md index 1cad38a..4ca85ba 100644 --- a/docs/workshop.pt-br.md +++ b/docs/workshop.pt-br.md @@ -120,7 +120,7 @@ Se você deseja trabalhar localmente sem usar um contêiner de desenvolvimento ( | | | | ---------------- | ---------------------------------------------------------------------------------------------------------------- | | Git | [Download do Git](https://git-scm.com) | -| Node.js v18+ | [Download do Node.js](https://nodejs.org) | +| Node.js v20+ | [Download do Node.js](https://nodejs.org) | | Azure CLI | [Download do Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli#install) | | GitHub CLI | [Download do GitHub CLI](https://cli.github.com/manual/installation) | | Bash v3+ | [Download do Bash](https://www.gnu.org/software/bash/) (usuários Windows podem usar **Git bash** que vem do Git) | @@ -925,7 +925,7 @@ Para configurar o GitHub Actions para implantação, precisaremos criar um novo Crie um novo arquivo em seu repositório com o caminho .`github/workflows/deploy.yml` e adicione o seguinte conteúdo: ```yml -# This workflow for our node.js 18 app does the following: +# This workflow for our node.js 20 app does the following: # - run tests # - build the app # - login to Azure with AZURE_CREDENTIALS github secret @@ -935,7 +935,7 @@ Crie um novo arquivo em seu repositório com o caminho .`github/workflows/deploy Depois de dar `Enter`, o Copilot pode tentar completar os comentários, mas não é isso que queremos. Então ignore se for esse o caso pressionando `Enter` novamente. Ele não deve começar a completar o fluxo de trabalho, continue aceitando sugestões até acabar com algo como isto: ```yaml -# This workflow for our node.js 18 app does the following: +# This workflow for our node.js 20 app does the following: # - run tests # - build the app # - login to Azure with AZURE_CREDENTIALS github secret @@ -952,11 +952,11 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Use Node.js 18 - uses: actions/setup-node@v2 + - uses: actions/checkout@v4 + - name: Use Node.js 20 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: Install dependencies run: npm ci - name: Run tests @@ -964,7 +964,7 @@ jobs: - name: Build run: npm run build - name: Login to Azure - uses: azure/login@v1 + uses: azure/login@v2 with: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Deploy to Azure @@ -1027,13 +1027,13 @@ Como você pode ver, é muito sutil e a opção `--name` tem significados difere Vamos continuar adicionando este comentário: ```bash -# Implante a aplicação com webapp usando node 18 +# Implante a aplicação com webapp usando node 20 ``` Agora, se você sugerir um comando semelhante ao que fez na primeira vez: ```bash -az webapp up --sku F1 --name copilot-nodejs-todo --resource-group rg-copilot-nodejs-todo --runtime "node|18-lts" +az webapp up --sku F1 --name copilot-nodejs-todo --resource-group rg-copilot-nodejs-todo --runtime "node|20-lts" ``` Novamente, aceite a sugestão, mas precisaremos ajustar um pouco a opção `--name` para torná-la única. Pois ela também servirá como URL para o seu aplicativo da web. Altere para algo como: `--name nodejs-todo-YOUR_GITHUB_USERNAME`. diff --git a/package.json b/package.json index 860c971..58918e5 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "concurrently": "^7.6.0" }, "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" + "node": ">=20.0.0", + "npm": ">=10.0.0" } }