Skip to content

Chore: update to use named exports #497

Chore: update to use named exports

Chore: update to use named exports #497

Workflow file for this run

name: Node.js CI
on:
push:
branches: [ '**' ]
tags: [ '**' ]
release:
types: [ 'created' ]
pull_request:
branches: [ '**' ]
jobs:
build:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN || '' }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID || '' }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
SOURCE_DIR: 'deploy'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install xvfb
run: sudo apt-get install xvfb
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install npm
run: npm install -g npm@8
- name: Install dependencies
run: npm ci
- name: Prepare Deploy
run: npm run deploy:ci
# All the below are deploy-related steps
- name: Extract Branch Name
id: branch_name
if: github.event_name == 'push' && !contains(github.ref, 'refs/tags')
run: echo BRANCH_NAME=${GITHUB_REF/refs\/heads\//} >> $GITHUB_OUTPUT
- name: Extract Tag Name
id: tag_name
if: github.event_name == 'release' || contains(github.ref, 'refs/tags')
run: echo TAG_NAME=${GITHUB_REF/refs\/tags\//} >> $GITHUB_OUTPUT
# Examples:
# 1) PR feature/acme merged into dev
# 2) branch A merged into branch B
# 3) branch A pushed directly to git
- name: Deploy Non-Tag Branches
uses: jakejarvis/s3-sync-action@master
if: github.event_name == 'push' && !contains(github.ref, 'refs/tags') && env.AWS_ACCESS_KEY_ID != ''
with:
args: --acl public-read --follow-symlinks --delete --cache-control "max-age=60"
env:
DEST_DIR: ${{ steps.branch_name.outputs.BRANCH_NAME }}
# Release is published and deployed into s3://bucket-name/v5.22/
- name: Deploy Released Branches
uses: jakejarvis/s3-sync-action@master
if: (github.event_name == 'release' || contains(github.ref, 'refs/tags')) && env.AWS_ACCESS_KEY_ID != ''
with:
args: --acl public-read --follow-symlinks --delete --cache-control "max-age=2592000"
env:
DEST_DIR: ${{ steps.tag_name.outputs.TAG_NAME }}
# Same release from previous deployed into s3://bucket-name/release/
- name: Deploy Latest Release
uses: jakejarvis/s3-sync-action@master
if: (github.event_name == 'release' || contains(github.ref, 'refs/tags')) && env.AWS_ACCESS_KEY_ID != ''
with:
args: --acl public-read --follow-symlinks --delete --cache-control "max-age=1209600"
env:
DEST_DIR: 'latest'
# Publish to NPM
- name: Publish Latest Release
if: github.event_name == 'release' && github.event.release.prerelease == false && env.NODE_AUTH_TOKEN != ''
run: npm run publish-ci
# Publish to NPM with prerelease dist-tag
- name: Publish Latest Prerelease
if: github.event_name == 'release' && github.event.release.prerelease && env.NODE_AUTH_TOKEN != ''
run: npm run publish-ci -- --tag prerelease