-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* build: add docker * Add or update the Azure App Service build and deployment workflow config * build: 🔧 add web.config and dynamic ports? * build: docker is no longer necessary * build: make workflow faster? * build: ✏️ fix workflow syntax * build: experiment with workflow * build: ⚗️ hey you also have to zip it! * build: ⚗️ prevent startup error * build: ⚗️ npm ci then start * build: ⚗️ try kuduscript * build: ⚗️ add npx? * build: ⚗️ forever.js * build: ⚗️ simplify workflow + other stuff * build: ⚗️ just do nest start * revert: 🗑️ clean up before merge * ci: 🔨 fix ci modifiers * style: 🎨 format workflow * build: ⚡ try to move package installation to deployment * build: 🔨 only run husky prepare in dev environment * build: ➕ add nestjs cli as a dep rather than dev dep
- Loading branch information
Showing
7 changed files
with
131 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# 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 - meiszwflz-test-v2 | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js version | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.x' | ||
|
||
- name: Zip artifact for deployment | ||
run: zip release.zip ./* -r | ||
|
||
- name: Upload artifact for deployment job | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: node-app | ||
path: release.zip | ||
|
||
- name: npm install, build, and test | ||
run: | | ||
npm install | ||
npm run build --if-present | ||
npm run test --if-present | ||
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@v3 | ||
with: | ||
name: node-app | ||
|
||
- name: 'Deploy to Azure Web App' | ||
id: deploy-to-webapp | ||
uses: azure/webapps-deploy@v2 | ||
with: | ||
app-name: 'meiszwflz-test-v2' | ||
slot-name: 'Production' | ||
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_291038A7A98943A8AA7C81155066199E }} | ||
package: release.zip | ||
|
||
- name: Delete zip file | ||
run: rm release.zip |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
if [ -d './node_modules/husky' ]; then | ||
npx husky install | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import { NestFactory } from '@nestjs/core'; | ||
import { AppModule } from './app.module'; | ||
|
||
const port = process.env.PORT || 3000; | ||
|
||
async function bootstrap() { | ||
const app = await NestFactory.create(AppModule); | ||
await app.listen(3000); | ||
await app.listen(port); | ||
} | ||
bootstrap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
This configuration file is required if iisnode is used to run node processes behind | ||
IIS or IIS Express. For more information, visit: | ||
https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config | ||
--> | ||
<configuration> | ||
<system.webServer> | ||
<!-- Visit http://blogs.msdn.com/b/windowsazure/archive/2013/11/14/introduction-to-websockets-on-windows-azure-web-sites.aspx for more information on WebSocket support --> | ||
<webSocket enabled="false" /> | ||
<handlers> | ||
<!-- Indicates that the dist/main.js file is a node.js site to be handled by the iisnode module --> | ||
<add name="iisnode" path="dist/main.js" verb="*" modules="iisnode" /> | ||
</handlers> | ||
<rewrite> | ||
<rules> | ||
<!-- Do not interfere with requests for node-inspector debugging --> | ||
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true"> | ||
<match url="^dist/main.js\/debug[\/]?" /> | ||
</rule> | ||
|
||
<!-- First we consider whether the incoming URL matches a physical file in the /public folder --> | ||
<rule name="StaticContent"> | ||
<action type="Rewrite" url="public{REQUEST_URI}" /> | ||
</rule> | ||
|
||
<!-- All other URLs are mapped to the node.js site entry point --> | ||
<rule name="DynamicContent"> | ||
<conditions> | ||
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" /> | ||
</conditions> | ||
<action type="Rewrite" url="dist/main.js" /> | ||
</rule> | ||
</rules> | ||
</rewrite> | ||
|
||
<!-- 'bin' directory has no special meaning in node.js and apps can be placed in it --> | ||
<security> | ||
<requestFiltering> | ||
<hiddenSegments> | ||
<remove segment="bin" /> | ||
</hiddenSegments> | ||
</requestFiltering> | ||
</security> | ||
|
||
<!-- Make sure error responses are left untouched --> | ||
<httpErrors existingResponse="PassThrough" /> | ||
<!-- | ||
You can control how Node is hosted within IIS using the following options: | ||
* watchedFiles: semi-colon separated list of files that will be watched for changes to restart the server | ||
* node_env: will be propagated to node as NODE_ENV environment variable | ||
* debuggingEnabled - controls whether the built-in debugger is enabled | ||
See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for a full list of options | ||
--> | ||
<!--<iisnode watchedFiles="web.config;*.js"/>--> | ||
</system.webServer> | ||
</configuration> |