Skip to content

Update deploy.yml

Update deploy.yml #55

Workflow file for this run

# Adapted from https://github.com/actions/starter-workflows/blob/e9e00b017736d3b3811cedf1ee2e8ceb3c48e3dd/ci/npm-publish.yml
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
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/action-setup@v2.2.4
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: true
- run: pnpm run build
- run: pnpm run changeset-status
- name: Create Release Pull Request or Publish to NPM
if: github.repository == 'keller-mark/pnpm-monorepo-example'
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