-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (50 loc) · 1.96 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 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