Skip to content

Commit a7f3093

Browse files
authored
Feature: Added GitHub Action for functions deploy & package release
1 parent 97501b7 commit a7f3093

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

.github/workflows/main.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Deploy Azure functions & release types to npm
2+
3+
on:
4+
[push]
5+
6+
env:
7+
AZURE_FUNCTIONAPP_NAME: mediumfunctionapp # your application's name in Azure
8+
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # path to your web app project, defaults to the repository root
9+
DOTNET_VERSION: '2.2.402' # dotnet version to use
10+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # dotnet version to use
11+
SWAGGER_LINK: https://mediumfunctionapp.azurewebsites.net/api/swagger # swagger document link (not UI)
12+
TYPES_FILENAME: index.d.ts # file with types
13+
TYPES_FOLDER: /Types # subfolder for npm package generation
14+
15+
jobs:
16+
release:
17+
name: release
18+
runs-on: ubuntu-18.04
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
22+
uses: actions/setup-dotnet@v1
23+
with:
24+
dotnet-version: ${{ env.DOTNET_VERSION }}
25+
26+
- name: 'Resolve Project Dependencies Using Dotnet'
27+
shell: pwsh
28+
run: |
29+
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
30+
dotnet build --configuration Release --output ./output
31+
popd
32+
33+
- name: 'Run Azure Functions deploy'
34+
uses: Azure/functions-action@v1
35+
id: fa
36+
with:
37+
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
38+
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
39+
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
40+
41+
- name: Get package to generate types
42+
run: npm i swagger-typescript-api
43+
44+
- name: Wait to make sure new functions are up
45+
uses: jakejarvis/wait-action@v0.1.0
46+
with:
47+
time: '30s'
48+
49+
- name: Generate types
50+
run: npx swagger-typescript-api -p ${{ env.SWAGGER_LINK }} -o ./ -n ${{ env.TYPES_FILENAME }}
51+
working-directory: ${{ env.TYPES_FOLDER }}
52+
53+
- name: Setup Node.js
54+
uses: actions/setup-node@v1
55+
with:
56+
node-version: 12
57+
58+
- name: Install type package dependencies
59+
run: npm ci
60+
working-directory: ${{ env.TYPES_FOLDER }}
61+
62+
- name: Publish package with types
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
66+
run: npx semantic-release
67+
working-directory: ${{ env.TYPES_FOLDER }}

0 commit comments

Comments
 (0)