Fix bundle (#89) #86
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
# Adapted from https://github.com/actions/starter-workflows/blob/e9e00b017736d3b3811cedf1ee2e8ceb3c48e3dd/ci/npm-publish.yml | |
name: Deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
pre_deploy: | |
runs-on: ubuntu-latest | |
name: Deploy | |
permissions: | |
# Permissions required for the changesets action | |
# to be able to create a new branch and open a pull request | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v3 | |
# Reference: https://github.com/changesets/changesets/issues/517#issuecomment-1182094769 | |
with: | |
ref: ${{github.event.pull_request.head.sha}} | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org/ | |
- uses: pnpm/[email protected] | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 8 | |
run_install: true | |
- name: Install Playwright Browsers | |
run: pnpm exec playwright install --with-deps | |
- run: | | |
pnpm run build | |
pnpm run build-json-schema | |
pnpm run bundle | |
- run: pnpm exec playwright test | |
- run: pnpm run changeset-status | |
- name: Create Release Pull Request or Publish to NPM | |
if: github.repository == 'keller-mark/use-coordination' | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
title: Create Release | |
# this expects you to have a npm script called changeset-version that runs some logic and then calls `changeset version`. | |
version: ./scripts/changeset-version.sh --action | |
# This expects you to have a script called changeset-publish which does a build for the packages and calls `changeset publish` | |
publish: ./scripts/changeset-publish.sh --action | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- id: get-tag | |
run: echo "tag=v$(cat ./package.json | jq -r .version)" >> $GITHUB_OUTPUT | |
- name: Upload release artifacts if publish occurred successfully | |
if: steps.changesets.outputs.should-release == 'true' | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ steps.get-tag.outputs.tag }} | |
body_path: RELEASE_NOTES.md | |
- name: Build demo site | |
run: | | |
cd sites/demo | |
pnpm run build-demo | |
touch dist/.nojekyll | |
cd - | |
- name: Build docs site | |
run: | | |
cd sites/docs | |
pnpm run build-root | |
touch dist-root/.nojekyll | |
cd - | |
- uses: actions/upload-pages-artifact@v1 | |
with: | |
path: sites/docs/dist-root | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
# Permissions required for the changesets action | |
# to be able to create a new branch and open a pull request | |
id-token: write | |
pages: write | |
needs: pre_deploy | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 | |