This repository has been archived by the owner on Aug 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to TypeScript and provide Docker image
Change-Id: If1666614676b92dd396d363a3068eac288f212ba
- Loading branch information
1 parent
1041811
commit b515b9b
Showing
24 changed files
with
11,854 additions
and
968 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,2 @@ | ||
node_modules/ | ||
build/ |
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,15 +1,13 @@ | ||
{ | ||
"extends": ["eslint:recommended", "google"], | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module" | ||
}, | ||
"env": { | ||
"es6": true, | ||
"node": true | ||
}, | ||
"rules": { | ||
"no-console": "off", | ||
"require-jsdoc": "off" | ||
} | ||
"extends": "./node_modules/gts/", | ||
"rules": { | ||
"no-console": "off", | ||
"require-jsdoc": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
"argsIgnorePattern": "^_" | ||
} | ||
] | ||
} | ||
} |
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,13 +1,7 @@ | ||
# git | ||
.git | ||
|
||
# nodejs | ||
node_modules/ | ||
yarn.lock | ||
#!include:.gitignore | ||
|
||
# sensitive | ||
*.json | ||
!package.json | ||
# git | ||
.git/ | ||
|
||
# temp | ||
.DS_Store | ||
# GitHub | ||
.github/ |
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,79 @@ | ||
# GitHub Release Workflow | ||
# Triggers: | ||
# 1. prereleased - a pre-release is created | ||
# 2. edited - a release, pre-release, or draft release is edited | ||
# Steps: | ||
# 1. Build from source | ||
# 2. Upload a zip artifact to the GitHub Release | ||
# 3. Build & Publish a Docker Image to GitHub Container Registry | ||
|
||
name: release | ||
|
||
on: | ||
release: | ||
types: [prereleased, edited] | ||
|
||
env: | ||
BUILD_DIR: "./dist/" | ||
PACK_BUILDER: gcr.io/buildpacks/builder:v1 | ||
FUNCTION_NAME: ${{ github.event.repository.name }} | ||
FUNCTION_TYPE: http | ||
REGISTRY: ghcr.io | ||
IMAGE: ${{ github.repository }} | ||
TAG: ${{ github.event.release.tag_name }} | ||
ARTIFACT: "${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.zip" | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source code | ||
# actions/[email protected] | ||
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 | ||
|
||
- name: Choose NodeJS version | ||
# actions/[email protected] | ||
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run build script | ||
run: npm run build | ||
|
||
- name: Zip & Upload to GitHub Release | ||
working-directory: ${{ env.BUILD_DIR }} | ||
run: | | ||
zip -r "$ARTIFACT" ./ | ||
gh release upload "$TAG" "$ARTIFACT" --clobber | ||
rm -f "$ARTIFACT" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Setup Buildpacks Pack | ||
# buildpacks/github-actions/[email protected] | ||
uses: buildpacks/github-actions/setup-pack@0b5cd009ad32942e90a3f9aef30c0a55cc9f4aed | ||
|
||
- name: Log in to the Container registry | ||
# docker/[email protected] | ||
uses: docker/login-action@42d299face0c5c43a0487c477f595ac9cf22f1a7 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build & Publish Docker image to GHCR | ||
working-directory: ${{ env.BUILD_DIR }} | ||
shell: bash | ||
run: | | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
pack build \ | ||
--path ./ \ | ||
--builder $PACK_BUILDER \ | ||
--env GOOGLE_FUNCTION_SIGNATURE_TYPE=$FUNCTION_TYPE \ | ||
--env GOOGLE_FUNCTION_TARGET=$FUNCTION_NAME \ | ||
--tag "$REGISTRY/$IMAGE:latest" \ | ||
--publish "$REGISTRY/$IMAGE:$TAG" |
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,10 +1,18 @@ | ||
# nodejs | ||
node_modules/ | ||
yarn.lock | ||
|
||
# sensitive | ||
# Eg: Service Account keyfiles | ||
*.json | ||
|
||
# nodejs | ||
node_modules/ | ||
!package.json | ||
!package-lock.json | ||
!tsconfig.json | ||
|
||
# misc | ||
*~ | ||
.DS_Store | ||
.vscode/ | ||
|
||
# temp | ||
.DS_Store | ||
# artifacts | ||
dist/ | ||
tsconfig.tsbuildinfo |
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,3 @@ | ||
module.exports = { | ||
...require('gts/.prettierrc.json') | ||
} |
Oops, something went wrong.