forked from nrkno/sofie-core
-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (142 loc) · 4.29 KB
/
prerelease-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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Publish prerelease libraries
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
lint-packages:
name: Lint Lib
runs-on: ubuntu-latest
continue-on-error: true
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
package-name:
- blueprints-integration
- server-core-integration
- shared-lib
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
- name: Prepare Environment
run: |
cd packages
yarn install
yarn lerna run --scope \*\*/${{ matrix.package-name }} --include-dependencies --stream build
env:
CI: true
- name: Run typecheck and linter
run: |
cd packages/${{ matrix.package-name }}
yarn lint
env:
CI: true
test-packages:
name: Test Lib
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
package-name:
- blueprints-integration
- server-core-integration
- shared-lib
node-version: [14.x, 16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Prepare Environment
run: |
cd packages
yarn install
yarn lerna run --scope \*\*/${{ matrix.package-name }} --include-dependencies --stream build
env:
CI: true
- name: Run tests
run: |
cd packages/${{ matrix.package-name }}
yarn unit
env:
CI: true
prerelease-libs:
name: Prerelease Lib
runs-on: ubuntu-latest
timeout-minutes: 15
needs:
- test-packages
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
- name: Check release is possible
id: do-publish
run: |
if [ -z "${{ secrets.NPM_TOKEN }}" ]; then
echo "No Token"
else
echo "Publish prerelease"
echo "publish=1" >> $GITHUB_OUTPUT
fi
- name: Prepare Environment
if: ${{ steps.do-publish.outputs.publish }}
run: |
cd packages
yarn install
env:
CI: true
- name: Bump version
if: ${{ steps.do-publish.outputs.publish }}
run: |
cd packages
COMMIT_TIMESTAMP=$(git log -1 --pretty=format:%ct HEAD)
COMMIT_DATE=$(date -d @$COMMIT_TIMESTAMP +%Y%m%d-%H%M%S)
GIT_HASH=$(git rev-parse --short HEAD)
PRERELEASE_TAG=nightly-$(echo "${{ github.ref_name }}" | sed -r 's/[^a-z0-9]+/-/gi')
git config --global user.email "[email protected]"
git config --global user.name "superflytvab"
yarn set-version-and-commit prerelease --preid $PRERELEASE_TAG-$COMMIT_DATE-$GIT_HASH
env:
CI: true
- name: Build
if: ${{ steps.do-publish.outputs.publish }}
run: |
cd packages
yarn build
env:
CI: true
- name: Build OpenAPI client library
if: ${{ steps.do-publish.outputs.publish }}
run: |
cd packages/openapi
yarn build
env:
CI: true
- name: Modify dependencies to use npm packages
run: node scripts/prepublish.js
- name: Publish to NPM
id: publish-npm
if: ${{ steps.do-publish.outputs.publish }}
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
cd packages
yarn lerna publish from-package --tag-version-prefix='' --dist-tag nightly --yes --no-verify-access
NEW_VERSION=$(node -p "require('./lerna.json').version")
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "**Published:** $NEW_VERSION" >> $GITHUB_STEP_SUMMARY
env:
CI: true