Skip to content

Publish

Publish #7

Workflow file for this run

name: Publish
on:
workflow_run:
workflows: ["CI"]
types:
- completed
push:
branches:
- "master"
# ensure no two publish workflows are not happening concurrently
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Pass a personal access token (using our `ct-release-bot` account) to be able to trigger
# other workflows
# https://help.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token
# https://github.community/t/action-does-not-trigger-another-on-push-tag-action/17148/8
token: ${{ secrets.REPO_TOKEN }}
- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm
- name: Setup Node (uses version in .nvmrc)
uses: actions/setup-node@v3
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Creating .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
[email protected]
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Building packages
run: yarn lint && yarn build
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: yarn changeset publish
version: yarn changeset:version-and-format
commit: 'ci(changesets): version packages'
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}