-
Notifications
You must be signed in to change notification settings - Fork 11
72 lines (70 loc) · 2.71 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
name: Release
on: [workflow_dispatch]
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# pulls all commits (needed for lerna / semantic release to correctly version)
fetch-depth: 0
- name: Setup Nodejs Env
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
# pulls all tags (needed for lerna / semantic release to correctly version)
- name: Pull All Git Tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- uses: fregante/setup-git-user@v1
- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VER }}
# lerna expects to be authenticated for publishing to NPM. This step will fail CI if NPM is not authenticated
- name: Check NPM authentication
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}" >> .npmrc
npm whoami
- name: Install and Setup Dependencies
run: npm ci
# build must come before running linting and tests for the `dist` directory to exist.
- name: Build
run: npm run build
- name: Lint
run: npm run lint
- name: Test
run: npm run test
- name: Coverage Report
uses: codecov/codecov-action@v3
- name: Update automation/lerna/version branch
run: |
git switch -C automation/lerna/version
git reset --hard origin/master
- name: Push the updated branch automation/lerna/version
run: |
git push -f origin automation/lerna/version
- name: Increment Versions of Changed Packages
run: |
npx lerna@6 version --yes --allow-branch automation/lerna/version --git-remote origin --conventional-commits --create-release github
git status
git push --set-upstream origin automation/lerna/version
git push origin --tags
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Lerna Versions PR
id: vpr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "chore(release): publish :tada:"
body: |
chore(release): publish :tada:
branch: automation/lerna/version
base: master
- name: Enable Lerna Versions PR Pull Request Automerge
if: steps.vpr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
pull-request-number: ${{ steps.vpr.outputs.pull-request-number }}
merge-method: squash