-
Notifications
You must be signed in to change notification settings - Fork 58
62 lines (62 loc) · 2.03 KB
/
prerelease.yaml
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
name: Prerelease
env:
CI: true
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
on:
workflow_dispatch:
push:
branches:
- main
jobs:
prerelease:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, '[no-release]') }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '18.16'
- name: Setup git user
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Build
run: npm run setup
- name: Disable branch protection
continue-on-error: true
uses: octokit/request-action@v2.x
with:
route: DELETE /repos/${{ github.repository }}/branches/main/protection
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
# In order to disable common version line remove the --force-publish flag in lerna command below
- name: Prerelease
run: |
npx lerna version --conventional-commits --conventional-prerelease --preid=rc --include-merged-tags --force-publish --yes
- name: Enable branch protection
uses: octokit/request-action@v2.x
with:
route: PUT /repos/${{ github.repository }}/branches/main/protection
required_pull_request_reviews: |
dismiss_stale_reviews: true
required_approving_review_count: 1
required_status_checks: |
strict: true
checks:
- context: 'on-label / Setup, Build, Lint and Test'
enforce_admins: true
restrictions: 'null'
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Publish
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> $HOME/.npmrc 2> /dev/null
npx lerna publish from-git --dist-tag=next --yes
- name: Unset Git User
run: |
git config --unset user.name
git config --unset user.email