Skip to content

Commit 0dae809

Browse files
author
Chazal
committed
chore(cicd): Add package and github release
1 parent 64dc71c commit 0dae809

File tree

4 files changed

+42
-38
lines changed

4 files changed

+42
-38
lines changed

.github/workflows/on-release.yml

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,50 @@ on:
55
- main
66
workflow_dispatch: {}
77
jobs:
8-
build:
8+
publish:
9+
# if: github.event.pull_request.merged == true
910
runs-on: ubuntu-latest
11+
1012
steps:
11-
- uses: actions/checkout@v2
12-
- name: Install packages
13-
run: |
14-
export NODE_ENV=dev
15-
npm ci
16-
npm run lerna-ci
17-
- name: Run lint
18-
run: npm run lerna-lint
19-
- name: Run tests
20-
run: npm run lerna-test
21-
release_github:
22-
name: Publish to GitHub Releases
23-
needs: release
24-
runs-on: ubuntu-latest
25-
permissions:
26-
contents: write
27-
if: needs.release.outputs.latest_commit == github.sha
28-
steps:
29-
- name: Download build artifacts
30-
uses: actions/download-artifact@v2
31-
with:
32-
name: dist
33-
path: dist
34-
- name: Release
35-
run: errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R
36-
$GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt)
37-
--target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode
38-
-ne 0 ] && ! grep -q "Release.tag_name already exists" $errout; then
39-
cat $errout; exit $exitcode; fi
40-
env:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42-
GITHUB_REPOSITORY: ${{ github.repository }}
43-
GITHUB_REF: ${{ github.ref }}
13+
- name: "Checkout"
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
18+
- name: "Use NodeJS 14"
19+
uses: actions/setup-node@v2
20+
with:
21+
node-version: '14'
22+
23+
- name: Install packages
24+
run: |
25+
npm ci
26+
npm run lerna-ci
27+
28+
# - name: "Setup npm"
29+
# run: |
30+
# npm set @xcanchal:registry=https://npm.pkg.github.com/xcanchal
31+
# npm set "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}"
32+
33+
- name: "Version and publish"
34+
env:
35+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: |
37+
git config user.name "${{ github.actor }}"
38+
git config user.email "${{ github.actor}}@users.noreply.github.com"
39+
40+
if [ ${{ github.base_ref }} = main ]; then
41+
npx lerna version --conventional-commits --create-release github --yes
42+
else
43+
npx lerna version --conventional-commits --conventional-prerelease --preid beta --create-release github --yes
44+
fi
45+
46+
# npx lerna publish from-git --yes
47+
4448
slack:
4549
name: Publish to slack channel
4650
needs:
47-
- release_npm
48-
- release_pypi
51+
- publish
4952
runs-on: ubuntu-latest
5053
steps:
5154
- name: publish latest release

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"package": "npm run package",
1212
"lerna-ci": "lerna exec -- npm ci",
1313
"lerna-test": "lerna exec -- npm run test",
14+
"lerna-package": "lerna exec -- npm run package",
1415
"lerna-build": "lerna exec -- tsc",
1516
"lerna-lint": "lerna exec -- eslint \"./{src,tests}/**/*.ts ./src/*.ts\"",
1617
"lerna-format": "lerna exec -- eslint --fix \"./{src,tests}/**/*.ts ./src/*.ts\"",

packages/logger/tests/unit/formatter/PowertoolLogFormatter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ describe('Class: PowertoolLogFormatter', () => {
256256
const formattedTypeError = formatter.formatError(<Error>error);
257257
expect(formattedTypeError).toEqual({
258258
location: expect.stringMatching(/PowertoolLogFormatter.test.ts:[0-9]+/),
259-
message: 'Cannot read property \'foo\' of null',
259+
message: expect.stringMatching(/Cannot read propert/),
260260
name: 'TypeError',
261261
stack: expect.stringMatching(/PowertoolLogFormatter.test.ts:[0-9]+:[0-9]+/),
262262
});

packages/logger/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"baseUrl": "src/",
1616
"rootDirs": [ "src/" ]
1717
},
18-
"include": [ "src/**/*", "examples/**/*" ],
18+
"include": [ "src/**/*", "examples/**/*", "tests/**/*" ],
1919
"exclude": [ "./node_modules"],
2020
"watchOptions": {
2121
"watchFile": "useFsEvents",

0 commit comments

Comments
 (0)