fix zeroes being ignored when calculating min #302
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
name: CD | |
on: | |
pull_request: | |
branches: [ '**' ] | |
push: | |
branches: [ '**' ] | |
jobs: | |
build-frontend: | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
# Start a deployment | |
- uses: actions/github-script@v1 | |
id: deploy_preview_start | |
with: | |
previews: "ant-man" | |
result-encoding: string | |
script: | | |
const createDeploymentResponse = await github.repos.createDeployment({ | |
...context.repo, | |
ref: context.sha, | |
environment: "deploy preview", | |
required_contexts: [], | |
}); | |
console.log('deployment id: ', createDeploymentResponse.data.id) | |
return createDeploymentResponse.data.id | |
- name: Use Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '16.x' | |
- name: Set node version env var | |
run: echo "NODE_VERSION=$(node --version)" >> $GITHUB_ENV | |
- uses: actions/cache@v1 | |
id: cache-dependencies | |
with: | |
# intentionally cache node_modules instead of yarn cache | |
path: node_modules | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
if: steps.cache-dependencies.outputs.cache-hit != 'true' | |
run: yarn --frozen-lockfile | |
- name: Build | |
run: yarn build | |
- name: Lint | |
run: yarn lint | |
- name: Test | |
run: yarn test | |
- name: Escaped Branch Name | |
id: collect_subdomain | |
# branch name, replacing `/`s with `-`s | |
run: echo "::set-output name=branch_name_escaped::$(git rev-parse --abbrev-ref HEAD | tr '/' '-')" | |
- name: Deploy Artifacts to GCP | |
uses: actions-hub/gcloud@master | |
env: | |
PROJECT_ID: npmcharts-210003 | |
APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} | |
CLI: gsutil | |
with: | |
args: -m cp -r packages/frontend/public gs://npmcharts/deployments/branches/${{ steps.collect_subdomain.outputs.branch_name_escaped }} | |
- name: Store deploy preview URL | |
id: store_deploy_url | |
run: | | |
echo "::set-output name=deploy_preview_url::https://deploy-preview--${{ steps.collect_subdomain.outputs.branch_name_escaped }}.deploys.npmcharts.com" | |
- uses: actions/github-script@v1 | |
id: deploy_preview_complete | |
with: | |
previews: "ant-man" | |
result-encoding: string | |
script: | | |
const createSuccessDeploymentStatus = await github.repos.createDeploymentStatus({ | |
...context.repo, | |
deployment_id: "${{ steps.deploy_preview_start.outputs.result }}", | |
state: "success", | |
environment_url: "${{ steps.store_deploy_url.outputs.deploy_preview_url }}", | |
headers: { | |
"Accept": "application/vnd.github.ant-man-preview+json" | |
}, | |
}); | |
console.log('createSuccessDeploymentStatus', createSuccessDeploymentStatus.data) |