Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit cf12ba6

Browse files
authored
Add new deployment (#499)
1 parent 078b146 commit cf12ba6

File tree

3 files changed

+70
-80
lines changed

3 files changed

+70
-80
lines changed

.github/workflows/deploy.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Deploy to Azure
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
env:
10+
NODE_VERSION: '18.x' # set this to the node version to use (supports 8.x, 10.x, 12.x)
11+
RESOURCE_GROUP_NAME: dtmergebot3
12+
FUNCTION_APP_NAME: dtmergebot3
13+
STORAGE_ACCOUNT_NAME: dtmergebot3b1b7
14+
STORAGE_CONTAINER_NAME: deployment
15+
FUNCTION_ZIP_NAME: function.zip
16+
17+
jobs:
18+
build:
19+
runs-on: windows-latest
20+
steps:
21+
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
22+
23+
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
24+
with:
25+
node-version: ${{ env.NODE_VERSION }}
26+
27+
- name: Install and test
28+
run: |
29+
npm install
30+
npm run build --if-present
31+
npm run test --if-present
32+
npm prune --production
33+
34+
- name: Upload artifact for deployment job
35+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
36+
with:
37+
name: node-app
38+
path: .
39+
40+
deploy:
41+
runs-on: ubuntu-latest
42+
needs: build
43+
environment:
44+
name: 'Production'
45+
permissions:
46+
id-token: write
47+
48+
steps:
49+
- name: Download artifact from build job
50+
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
51+
with:
52+
name: node-app
53+
54+
- name: Create zip
55+
run: zip -r ${{ env.FUNCTION_ZIP_NAME }} .
56+
57+
- uses: azure/login@6b2456866fc08b011acb422a92a4aa20e2c4de32 # v2.1.0
58+
with:
59+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
60+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
61+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
62+
63+
- name: Upload blob
64+
run: az storage blob upload -f ${{ env.FUNCTION_ZIP_NAME }} --account-name ${{ env.STORAGE_ACCOUNT_NAME }} -c ${{ env.STORAGE_CONTAINER_NAME }} -n ${{ env.FUNCTION_ZIP_NAME }} --overwrite true --auth-mode login
65+
66+
# - name: Set package path
67+
# run: az functionapp config appsettings set -g ${{ env.RESOURCE_GROUP_NAME }} -n ${{ env.FUNCTION_APP_NAME }} --settings WEBSITE_RUN_FROM_PACKAGE="https://${{ env.STORAGE_ACCOUNT_NAME }}.blob.core.windows.net/${{ env.STORAGE_CONTAINER_NAME }}/${{ env.FUNCTION_ZIP_NAME }}"
68+
69+
- name: Restart app
70+
run: az functionapp restart -g ${{ env.RESOURCE_GROUP_NAME }} -n ${{ env.FUNCTION_APP_NAME }}

.github/workflows/master_dtmergebot2.yml

Lines changed: 0 additions & 79 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
"update-test-data": "npm run build && node dist/commands/update-test-data.js",
6767
"update-all-fixtures": "npm run build && node dist/commands/update-all-fixtures.js",
6868
"start": "func start",
69-
"deploy": "func azure functionapp publish dtmergebot2",
7069
"lint": "eslint --report-unused-disable-directives .",
7170
"test": "jest"
7271
},

0 commit comments

Comments
 (0)