Skip to content

Commit

Permalink
feat: update workflows and use Node 20
Browse files Browse the repository at this point in the history
  • Loading branch information
sinedied committed Jul 22, 2024
1 parent bc0629e commit 8dac017
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 34 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,19 +15,19 @@ 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
run: npm test
- 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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**.
Expand Down
20 changes: 10 additions & 10 deletions docs/workshop.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -913,19 +913,19 @@ 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
run: npm test
- 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
Expand Down Expand Up @@ -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`.
Expand Down
20 changes: 10 additions & 10 deletions docs/workshop.pt-br.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -952,19 +952,19 @@ 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
run: npm test
- 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
Expand Down Expand Up @@ -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`.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

0 comments on commit 8dac017

Please sign in to comment.