Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: update to use named exports #401

Merged
merged 18 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 25 additions & 30 deletions .github/workflows/nodejs.yml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,85 +1,78 @@
name: Node.js CI

name: Automation
on:
push:
branches: [ '**' ]
tags: [ '**' ]
release:
types: [ published ]
pull_request:
branches: [ '**' ]

jobs:
build:
name: 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: 'dist'
SOURCE_DIR: 'deploy'
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Canvas Dependencies
- uses: actions/checkout@v3
- name: Install xvfb
run: sudo apt-get install xvfb
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- name: Install npm
run: npm install -g npm@8
- name: Install Dependencies
run: npm install
run: npm ci

- name: Build for Distribution
run: xvfb-run --auto-servernum npm run deploy:ci

# All the below are deploy-related steps
- name: Extract Branch Name
id: branch_name
if: github.event_name == 'push'
if: github.event_name == 'push' && !contains(github.ref, 'refs/tags')
run: echo BRANCH_NAME=${GITHUB_REF/refs\/heads\//} >> $GITHUB_OUTPUT

- name: Build for Distribution
run: xvfb-run --auto-servernum npm run dist

# Append assets to releases
- name: Upload Assets to Release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: |
./bundle/dist/browser/*
- 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' && env.AWS_ACCESS_KEY_ID != ''
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.2.2/
# 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' && env.AWS_ACCESS_KEY_ID != ''
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: ${{ github.event.release.tag_name }}
DEST_DIR: ${{ steps.tag_name.outputs.TAG_NAME }}

# Same release from previous deployed into s3://bucket-name/latest/
# 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' && github.event.release.prerelease == false && env.AWS_ACCESS_KEY_ID != ''
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 != ''
Expand All @@ -88,4 +81,6 @@ jobs:
# 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 -- --dist-tag prerelease
run: npm run publish-ci
env:
XS_PUBLISH_TAG: prerelease
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ node_modules
*.log
docs
dist
lib
deploy
tools/demo/index.js
tools/demo/index.js.map
.DS_Store
/out
filters/*/index.d.ts
bundle/index.d.ts
example.api.*
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

Loading