Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit 76243bc

Browse files
authored
Merge pull request #1 from leandro3810/copilot/analyze-test-coverage
Add Express-based portfolio app and harden Azure deploy workflow
2 parents 9004a7e + 6f0bd23 commit 76243bc

12 files changed

Lines changed: 1461 additions & 40 deletions

File tree

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,12 @@
1-
# This workflow will build and push a node.js application to an Azure Web App when a commit is pushed to your default branch.
2-
#
3-
# This workflow assumes you have already created the target Azure App Service web app.
4-
# For instructions see https://docs.microsoft.com/en-us/azure/app-service/quickstart-nodejs?tabs=linux&pivots=development-environment-cli
5-
#
6-
# To configure this workflow:
7-
#
8-
# 1. Download the Publish Profile for your Azure Web App. You can download this file from the Overview page of your Web App in the Azure Portal.
9-
# For more information: https://docs.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=applevel#generate-deployment-credentials
10-
#
11-
# 2. Create a secret in your repository named AZURE_WEBAPP_PUBLISH_PROFILE, paste the publish profile contents as the value of the secret.
12-
# For instructions on obtaining the publish profile see: https://docs.microsoft.com/azure/app-service/deploy-github-actions#configure-the-github-secret
13-
#
14-
# 3. Change the value for the AZURE_WEBAPP_NAME. Optionally, change the AZURE_WEBAPP_PACKAGE_PATH and NODE_VERSION environment variables below.
15-
#
16-
# For more information on GitHub Actions for Azure: https://github.com/Azure/Actions
17-
# For more information on the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
18-
# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples
19-
201
on:
212
push:
223
branches: [ "main" ]
234
workflow_dispatch:
245

256
env:
26-
AZURE_WEBAPP_NAME: your-app-name # set this to your application's name
27-
AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
28-
NODE_VERSION: '20.x' # set this to the node version to use
7+
AZURE_WEBAPP_NAME: your-app-name
8+
AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
9+
NODE_VERSION: '20.x'
2910

3011
permissions:
3112
contents: read
@@ -42,19 +23,28 @@ jobs:
4223
node-version: ${{ env.NODE_VERSION }}
4324
cache: 'npm'
4425

45-
- name: npm install, build, and test
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Build application
30+
run: npm run build
31+
32+
- name: Run tests
33+
run: npm test
34+
35+
- name: Prepare deployment package
4636
run: |
47-
npm install
48-
npm run build --if-present
49-
npm run test --if-present
37+
mkdir -p release
38+
cp -R public src package.json package-lock.json server.js release/
5039
5140
- name: Upload artifact for deployment job
52-
uses: actions/upload-artifact@v3
41+
uses: actions/upload-artifact@v4
5342
with:
5443
name: node-app
55-
path: .
44+
path: release
5645

5746
deploy:
47+
if: ${{ env.AZURE_WEBAPP_NAME != 'your-app-name' && env.AZURE_WEBAPP_PUBLISH_PROFILE != '' }}
5848
permissions:
5949
contents: none
6050
runs-on: ubuntu-latest
@@ -65,7 +55,7 @@ jobs:
6555

6656
steps:
6757
- name: Download artifact from build job
68-
uses: actions/download-artifact@v3
58+
uses: actions/download-artifact@v4.1.3
6959
with:
7060
name: node-app
7161

@@ -74,5 +64,5 @@ jobs:
7464
uses: azure/webapps-deploy@v2
7565
with:
7666
app-name: ${{ env.AZURE_WEBAPP_NAME }}
77-
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
78-
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
67+
publish-profile: ${{ env.AZURE_WEBAPP_PUBLISH_PROFILE }}
68+
package: .

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
npm-debug.log*
3+
.DS_Store

README.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
1-
# What is this?
1+
# Leandro Dev
22

3-
The github.dev web-based editor is a lightweight editing experience that runs entirely in your browser. You can navigate files and source code repositories from GitHub, and make and commit code changes.
3+
Projeto base em Node.js com:
44

5-
There are two ways to go directly to a VS Code environment in your browser and start coding:
5+
- landing page profissional
6+
- seção de portfólio
7+
- tela de login demonstrativa
8+
- página de contato
9+
- API simples em Express
10+
- workflow GitHub Actions com CI e deploy opcional no Azure
611

7-
* Press the . key on any repository or pull request.
8-
* Swap `.com` with `.dev` in the URL. For example, this repo https://github.com/github/dev becomes http://github.dev/github/dev
12+
## Como executar
913

10-
Preview the gif below to get a quick demo of github.dev in action.
14+
```bash
15+
npm install
16+
npm run build
17+
npm test
18+
npm start
19+
```
1120

12-
![github dev](https://user-images.githubusercontent.com/856858/130119109-4769f2d7-9027-4bc4-a38c-10f297499e8f.gif)
21+
O servidor sobe por padrão em `http://localhost:3000`.
1322

14-
# Why?
15-
It’s a quick way to edit and navigate code. It's especially useful if you want to edit multiple files at a time or take advantage of all the powerful code editing features of Visual Studio Code when making a quick change. For more information, see our [documentation](https://github.co/codespaces-editor-help).
23+
## Rotas principais
24+
25+
- `/` landing page e portfólio
26+
- `/login` tela de login
27+
- `/contato` página de contato
28+
- `/api/profile` dados do perfil
29+
- `/api/login` login demonstrativo
30+
- `/api/contact` envio de contato

0 commit comments

Comments
 (0)