-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
61 lines (61 loc) · 2.05 KB
/
action.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
name: 'Release'
description: 'Allows semantic-release to be executed in a monorepo'
inputs:
github-token:
description: 'The GitHub token to use for releasing'
required: true
npm-token:
description: 'The NPM token to use for releasing'
required: true
runs:
using: "composite"
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/[email protected]
- name: "Temporarily disable 'include administrators' branch protection"
id: disable_include_admins
uses: benjefferies/branch-protection-bot@master
if: always()
with:
access_token: ${{ inputs.github-token }}
branch: ${{ steps.branch-name.outputs.current_branch }}
enforce_admins: false
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 'lts/*'
- name: Cache dependencies
id: cache
uses: actions/cache@v2
with:
path: ./node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci --ignore-scripts
shell: bash
- name: Release
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
NPM_TOKEN: ${{ inputs.npm-token }}
BRANCH_NAME: ${{ steps.branch-name.outputs.current_branch }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
for feat in $(pwd)/packages/*; do
cd $feat
(npx semantic-release) || true
done
git add -A
git commit -m "ci: Version bump; update changelog"
git pull --no-ff
git push
shell: bash
- name: "Restore 'include administrators' default branch protection"
uses: benjefferies/branch-protection-bot@master
if: always()
with:
access_token: ${{ inputs.github-token }}
branch: ${{ steps.branch-name.outputs.current_branch }}
enforce_admins: ${{ steps.disable_include_admins.outputs.initial_status }}