Skip to content

Commit

Permalink
Publishing zipped function to a new release on github
Browse files Browse the repository at this point in the history
  • Loading branch information
SoTrx committed Jun 28, 2021
1 parent 81428a5 commit c712e42
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 36 deletions.
12 changes: 11 additions & 1 deletion .funcignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,14 @@
.vscode
local.settings.json
test
tsconfig.json
tsconfig.json
*.zip
__blobstorage__
__queuestorage__
coverage
deploy*
readme.me
yarn*.log
.dockerignore
.eslint*
__azurite*
33 changes: 0 additions & 33 deletions .github/workflows/build-and-push.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/create-new-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Create a new release

on:
push:
tags:
- "v*"

jobs:
build:
runs-on: ubuntu-latest
name: Build and Push
steps:
- name: Get tag
uses: olegtarasov/[email protected]
id: tagName
with:
tagRegex: "v(.*)"

- name: git-checkout
uses: actions/checkout@v2

- name: Install all dependencies && Generate zip
run: npm pack

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.tagName.outputs.tag }}

- name: Include packaged function in release
id: upload-release-asset-latest
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./out.zip
asset_name: ./function-upload-to-blob.zip
asset_content_type: application/octet-stream
2 changes: 1 addition & 1 deletion .github/workflows/generate-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Coverage
name: Generate coverage
on:
push:
branches:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-dockerhub.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker CD
name: Publish docker image to dockerhub
on:
push:
branches:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,6 @@ appsettings.json
local.settings.json
*.bicep
deploy*
.vscode
__*storage__
__azurite*
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"prepack": "npx shx rm -rf dist node_modules && npm install && npm run build && npm prune --production --force",
"pack": "tar.exe --exclude-from=.funcignore -a -c -f out.zip .",
"postpack": "npm install",
"prestart": "npm run build",
"start": "func start",
"test": "jest",
Expand All @@ -17,6 +20,7 @@
"uuid": "^8.3.2"
},
"devDependencies": {
"7zip-bin": "^5.1.1",
"@azure/functions": "^1.2.3",
"@fluffy-spoon/substitute": "^1.208.0",
"@types/form-data": "^2.5.0",
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ See [application settings documentation](https://docs.microsoft.com/en-us/azure/

## Running tests

Two types of tests are included :
- index.test.ts files are for unit testing, included in the coverage
- index.e2e.test.ts files needs the function server to run (using `yarn start`). These are excluded from the coverage report. You will also need your own *localsettings.json*.

## Sample client-side service (Browser code, Typescript)

```ts
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
# yarn lockfile v1


"7zip-bin@^5.1.1":
version "5.1.1"
resolved "https://registry.yarnpkg.com/7zip-bin/-/7zip-bin-5.1.1.tgz#9274ec7460652f9c632c59addf24efb1684ef876"
integrity sha512-sAP4LldeWNz0lNzmTird3uWfFDWWTeg6V/MsmyyLR9X1idwKBWIgt/ZvinqQldJm3LecKEs1emkbquO6PCiLVQ==

"@azure/abort-controller@^1.0.0":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@azure/abort-controller/-/abort-controller-1.0.4.tgz#fd3c4d46c8ed67aace42498c8e2270960250eafd"
Expand Down

0 comments on commit c712e42

Please sign in to comment.