-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (78 loc) · 2.79 KB
/
release-libs.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: 'Release libraries to Github Packages'
on:
# release:
# types: [published]
workflow_dispatch:
push:
branches:
- 'main'
paths:
- 'packages/libs/js-lib/src/**'
- 'packages/libs/ui-lib/src/**'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
jslib:
- 'packages/libs/js-lib/src/**'
uilib:
- 'packages/libs/ui-lib/src/**'
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
scope: '@octocat'
- name: Authenticate to Github packages
run: |
echo "@homebase-id:registry=https://npm.pkg.github.com" > .npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
# Set git User & Bump the version: https://docs.npmjs.com/cli/v8/commands/npm-version
- name: Bump js-lib version
if: steps.filter.outputs.jslib == 'true'
run: |
git config user.name github-actions
git config user.email [email protected]
npm version prerelease --w ./packages/libs/js-lib
# Set git User & Bump the version: https://docs.npmjs.com/cli/v8/commands/npm-version
- name: Bump ui-lib version
if: steps.filter.outputs.uilib == 'true'
run: |
git config user.name github-actions
git config user.email [email protected]
npm version prerelease --w ./packages/libs/ui-lib
- run: npm ci
- name: Build JS Lib
run: npm run build --w ./packages/libs/js-lib
- name: Test JS Lib
run: npm run test -w ./packages/libs/js-lib
- name: Publish JS Lib
if: steps.filter.outputs.jslib == 'true'
run: npm publish --w ./packages/libs/js-lib
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build UI Lib
run: npm run build --w ./packages/libs/ui-lib
- name: Publish UI Lib
if: steps.filter.outputs.uilib == 'true'
run: npm publish --w ./packages/libs/ui-lib
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Push the version increment back into the repo
- name: Restore npmrc updates
run: |
git restore .npmrc
- name: Create PR for NPM version bump
id: version-bump
uses: peter-evans/create-pull-request@v6
with:
branch-suffix: short-commit-hash
commit-message: 'Bump version for js-lib and/or ui-lib'
title: 'Bump version for js-lib and/or ui-lib'
body: ''