Skip to content

Use powers of ten for large numbers #72

Use powers of ten for large numbers

Use powers of ten for large numbers #72

name: Bristemouth UI Build
on:
# Run on all pull requests and on pushes to main.
pull_request:
push:
branches:
- main
jobs:
build_and_deploy:
runs-on: ubuntu-22.04
env:
surge_url: bristemouth-ui-${{ github.event.pull_request.number }}.surge.sh
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20
- uses: actions/cache@v2
id: yarn-cache
with:
path: |
**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies if needed.
id: install
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
yarn install --frozen-lockfile
- name: Build website
id: build_website
if: steps.install.conclusion == 'skipped' || steps.install.conclusion == 'success'
run: yarn build
# we want to build on main branch, but not deploy a preview on surge
- name: Deploy pull request on surge
if: steps.build_website.outcome == 'success' && github.event.pull_request.number != null
uses: dswistowski/surge-sh-action@v1
with:
domain: ${{ env.surge_url }}
project: "dist/."
login: ${{ secrets.surge_login }}
token: ${{ secrets.surge_token }}
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_OUTPUT
- name: Comment PR
uses: marocchino/sticky-pull-request-comment@v1
continue-on-error: true
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: |
Build succeeded and deployed at https://${{ env.surge_url }}
(hash ${{ github.event.pull_request.head.sha }} deployed at ${{ steps.date.outputs.date }})