Skip to content

Commit f909a1a

Browse files
committed
GH actions
1 parent 869c6d2 commit f909a1a

2 files changed

Lines changed: 60 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
jobs:
11+
release:
12+
name: Release
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Repo
16+
# https://github.com/actions/checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Setup Node.js
20+
# https://github.com/actions/setup-node
21+
uses: actions/setup-node@v2
22+
with:
23+
node-version: 16.x
24+
25+
- uses: actions/cache@v2
26+
id: yarn-cache
27+
with:
28+
path: '**/node_modules'
29+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
30+
31+
- name: Install dependencies
32+
if: steps.yarn-cache.outputs.cache-hit != 'true'
33+
run: yarn --frozen-lockfile --ignore-scripts
34+
35+
- name: Create Release Pull Request or Publish to npm
36+
id: changesets
37+
# https://github.com/changesets/action
38+
uses: changesets/action@v1
39+
with:
40+
createGithubReleases: false
41+
publish: yarn release
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
45+
46+
- name: View outputs
47+
run: echo ${{join(steps.changesets.outputs.*, ' ')}}
48+
49+
- name: Create Release
50+
if: steps.changesets.outputs.published == 'true'
51+
uses: actions/create-release@v1
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
with:
55+
tag_name: ${{ steps.aggregate.outputs.version }}
56+
release_name: ${{ steps.aggregate.outputs.version }}
57+
body: ${{ steps.aggregate.outputs.notes }}
58+
draft: false
59+
prerelease: false

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"license": "MIT",
1414
"scripts": {
1515
"clean": "rm -rf dist && rm -rf test/dist",
16+
"release": "yarn build && yarn changeset publish",
1617
"build": "yarn clean && yarn build:esm && yarn build:cjs && ./module-fixup.sh",
1718
"test": "AWS_SDK_LOAD_CONFIG=1 vitest",
1819
"build:esm": "tsc -p tsconfig-esm.json",

0 commit comments

Comments
 (0)