New superstardle site, uses visx/drag (#1799) #170
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: Push | |
on: | |
push: | |
branches: [master] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 # checkout visx + this commit | |
with: | |
# pulls all commits (needed for lerna to correctly release only changed packages) | |
fetch-depth: '0' | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '16.14.0' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v1 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: π‘ Install dependencies | |
run: yarn install --frozen-lockfile --ignore-engines | |
- name: π Build packages | |
run: yarn build | |
- name: π Commit package sizes | |
if: github.repository_owner == 'airbnb' | |
# note: `git diff-index --quiet HEAD` | |
# has exit code 0 if there are changes vs HEAD, else nothing to commit | |
run: | | |
yarn build:sizes | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add . | |
git diff-index --quiet HEAD || git commit -m "build(${GITHUB_SHA}): auto-commit package sizes" | |
git push | |
- name: π Release | |
if: github.repository_owner == 'airbnb' | |
# the following configurations are needed for lerna to | |
# - have git credentials for commiting tags | |
# - have correct npm credentials for publishing (yarn does not work) | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
yarn logout | |
npm config set '//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}' | |
yarn build:release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: π¨ Build and deploy gallery | |
# below we | |
# - setup git credentials provided via actions/checkout@v2 | |
# - initialize gh-pages-branch as an orphan branch so we don't build history | |
# - checkout the current commit and create gh-pages-root-dir/ as a new worktree | |
# - outside that directory HEAD is detached at $GITHUB_SHA | |
# - within that directory we are on the gh-pages-branch we just initialized | |
# *worktree initialization should be in a root dir, otherwise the worktree inherits nested directories | |
# - build the static next.js site and copy the output into gh-pages-root-dir/ | |
# - we can't output directly into gh-pages-root-dir/ because next wipes the folder including .git | |
# - commit the demo site within gh-pages-root-dir/ onto the gh-pages-branch | |
# - push gh-pages-branch to visx as gh-pages. we overwrite history every time so it must be forced | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git checkout --orphan gh-pages-branch | |
git reset --hard | |
touch .nojekyll | |
git add .nojekyll | |
git commit -m "bot(${GITHUB_SHA}): initialize gh-pages branch" | |
git checkout "$GITHUB_SHA" | |
git worktree add gh-pages-root-dir gh-pages-branch | |
cd ./packages/visx-demo/ | |
yarn build | |
mv -v out/* ../../gh-pages-root-dir/ | |
cd ../../gh-pages-root-dir/ | |
git add . | |
git commit -m "bot(${GITHUB_SHA}): build gh-pages" | |
git push -f "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" HEAD:gh-pages | |
- name: π¦ Run happo | |
# not running happo on push results in stale base shas in pull_request | |
run: yarn run happo-ci-github-actions | |
working-directory: './packages/visx-demo/' | |
env: | |
HAPPO_API_KEY: ${{ secrets.HAPPO_API_KEY }} | |
HAPPO_API_SECRET: ${{ secrets.HAPPO_API_SECRET }} | |
HAPPO_COMMAND: '../../node_modules/happo.io/build/cli.js' |