This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
77 lines (74 loc) · 2.36 KB
/
release.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: MDC Release
# This workflow does the following if repo does not have git tag that was updated in lerna.json
# - creates release git tag
# - publishes packages to NPM with latest tag
#
# This workflow is expected to run after merge of release pull requested created by release-pull-request workflow.
on:
push:
branches:
- master
paths:
- "lerna.json"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0
- name: Fetch all tags
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: |
npm ci --ignore-scripts
npm run bootstrap
- name: Read version created by Lerna.js
id: lerna_version
run: |
echo "::set-output name=version::v$(npm run version --silent)"
- name: Check if release tag is already created
id: vars
run: |
lerna_version=${{ steps.lerna_version.outputs.version }}
if [[ -z $(git tag -l "$lerna_version") ]]; then
echo "Proceeding to create new release"
else
echo "New release already created, exiting."
exit 1
fi
- name: Build packages
run: |
npm run dist
node scripts/cp-pkgs.js
node scripts/verify-pkg-main.js
git reset --hard
- name: Create release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ steps.lerna_version.outputs.version }}
release_name: ${{ steps.lerna_version.outputs.version }}
body: |
See CHANGELOG file to see what's changed in new release.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to NPM registry
run: npx lerna publish from-package --yes
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}