Skip to content

Commit decf469

Browse files
authored
Update azure-webapps-node.yml
1 parent 477ca4a commit decf469

1 file changed

Lines changed: 2 additions & 153 deletions

File tree

Lines changed: 2 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -1,155 +1,4 @@
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-
20-
on:
21-
push:
22-
branches: [ "main" ]
23-
workflow_dispatch:
24-
25-
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
29-
30-
permissions:
31-
contents: read
32-
33-
jobs:
34-
build:
35-
runs-on: ubuntu-latest
36-
steps:
37-
- uses: actions/checkout@v4
38-
39-
- name: Set up Node.js
40-
uses: actions/setup-node@v4
41-
with:
42-
node-version: ${{ env.NODE_VERSION }}
43-
cache: 'npm'
44-
45-
- name: npm install, build, and test
46-
run: |
47-
npm install
48-
npm run build --if-present
49-
npm run test --if-present
50-
51-
- name: Upload artifact for deployment job
52-
uses: actions/upload-artifact@v4
53-
with:
54-
name: node-app
55-
path: .
56-
57-
deploy:
58-
permissions:
59-
contents: none
60-
runs-on: ubuntu-latest
61-
needs: build
62-
environment:
63-
name: 'Development'
64-
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
65-
66-
steps:
67-
- name: Download artifact from build job
68-
uses: actions/download-artifact@v4
69-
with:
70-
name: node-app
71-
72-
- name: 'Deploy to Azure WebApp'
73-
id: deploy-to-webapp
74-
uses: azure/webapps-deploy@v2
75-
with:
76-
app-name: ${{ env.AZURE_WEBAPP_NAME }}
77-
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
78-
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
79-
80-
- name: Cache
81-
uses: actions/cache@v5.0.4
82-
with:
83-
# A list of files, directories, and wildcard patterns to cache and restore
84-
path:
85-
# An explicit key for restoring and saving the cache
86-
key:
87-
# An ordered multiline string listing the prefix-matched keys, that are used for restoring stale cache if no cache hit occurred for key. Note `cache-hit` returns false in this case.
88-
restore-keys: # optional
89-
# The chunk size used to split up large files during upload, in bytes
90-
upload-chunk-size: # optional
91-
# An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms
92-
enableCrossOsArchive: # optional, default is false
93-
# Fail the workflow if cache entry is not found
94-
fail-on-cache-miss: # optional, default is false
95-
# Check if a cache entry exists for the given input(s) (key, restore-keys) without downloading the cache
96-
lookup-only: # optional, default is false
97-
# Run the post step to save the cache even if another step before fails
98-
save-always: # optional, default is false
99-
- name: Setup Node.js environment
100-
uses: actions/setup-node@v6.3.0
101-
with:
102-
# Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.
103-
node-version: # optional
104-
# File containing the version Spec of the version to use. Examples: package.json, .nvmrc, .node-version, .tool-versions.
105-
node-version-file: # optional
106-
# Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.
107-
architecture: # optional
108-
# Set this option if you want the action to check for the latest available version that satisfies the version spec.
109-
check-latest: # optional
110-
# Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.
111-
registry-url: # optional
112-
# Optional scope for authenticating against scoped registries. Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/).
113-
scope: # optional
114-
# Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
115-
token: # optional, default is ${{ github.server_url == 'https://github.com' && github.token || '' }}
116-
# Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.
117-
cache: # optional
118-
# Set to false to disable automatic caching. By default, caching is enabled when either devEngines.packageManager or the top-level packageManager field in package.json specifies npm as the package manager.
119-
package-manager-cache: # optional, default is true
120-
# Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.
121-
cache-dependency-path: # optional
122-
# Used to specify an alternative mirror to download Node.js binaries from
123-
mirror: # optional
124-
# The token used as Authorization header when fetching from the mirror
125-
mirror-token: # optional
126-
- name: Download a Build Artifact
127-
uses: actions/download-artifact@v3.1.0
128-
with:
129-
# Artifact name
130-
name: # optional
131-
# Destination path
132-
path: # optional
133-
- name: Setup Go environment
134-
uses: actions/setup-go@v6.4.0
135-
with:
136-
# The Go version to download (if necessary) and use. Supports semver spec and ranges. Be sure to enclose this option in single quotation marks.
137-
go-version: # optional
138-
# Path to the go.mod, go.work, .go-version, or .tool-versions file.
139-
go-version-file: # optional
140-
# Set this option to true if you want the action to always check for the latest available version that satisfies the version spec
141-
check-latest: # optional
142-
# Used to pull Go distributions from go-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
143-
token: # optional, default is ${{ github.server_url == 'https://github.com' && github.token || '' }}
144-
# Used to specify whether caching is needed. Set to true, if you'd like to enable caching.
145-
cache: # optional, default is true
146-
# Used to specify the path to a dependency file (e.g., go.mod, go.sum)
147-
cache-dependency-path: # optional
148-
# Target architecture for Go to use. Examples: x86, x64. Will use system architecture by default.
149-
architecture: # optional
150-
# Custom base URL for downloading Go distributions. Use this to download Go from a mirror or custom source. Defaults to "https://go.dev/dl". Can also be set via the GO_DOWNLOAD_BASE_URL environment variable. The input takes precedence over the environment variable.
151-
go-download-base-url: # optional
152-
- name: First interaction
1+
- name: First interaction
1532
uses: actions/first-interaction@v1.3.0
1543
with:
1554
# Token for the repository. Can be passed in using {{ secrets.GITHUB_TOKEN }}
@@ -158,4 +7,4 @@ jobs:
1587
issue-message: # optional
1598
# Comment to post on an individual's first pull request
1609
pr-message: # optional
161-
10+

0 commit comments

Comments
 (0)