Skip to content

Commit 1d4caab

Browse files
authored
chore: Add workflows (#123)
1 parent 624b208 commit 1d4caab

File tree

4 files changed

+79
-1
lines changed

4 files changed

+79
-1
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish mobx-devtools-mst
2+
3+
on:
4+
push:
5+
paths: [ "packages/mobx-devtools-mst/**", ".github/**" ]
6+
branches: [ "master" ]
7+
8+
jobs:
9+
publish-npm:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-node@v3
14+
with:
15+
node-version: 16
16+
registry-url: https://registry.npmjs.org/
17+
- run: npm run bootstrap
18+
- name: Resolve new package version & Publish
19+
working-directory: ./packages/mobx-devtools-mst
20+
run: |
21+
NAME=$(node -p "require('./package.json').name")
22+
VERSION=$(node -p "require('./package.json').version")
23+
export LATEST=$(npm show "$NAME@$VERSION" version --json)
24+
NEXT=$(node -p "JSON.parse(process.env.LATEST).split('.').map((n, i) => i === 2 ? ++n : n).join('.')")
25+
echo "NEXT: $NEXT"
26+
npm version $NEXT --git-tag-version false
27+
npm run build
28+
cat ./package.json
29+
npm publish
30+
env:
31+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
32+

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Release
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
release:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- uses: actions/setup-node@v3
11+
with:
12+
node-version: 17
13+
registry-url: https://registry.npmjs.org/
14+
- run: npm run bootstrap
15+
- run: npm run build
16+
- run: |
17+
TAG=$(echo $TAG | cut -c1-8)
18+
gh release create "$TAG" \
19+
--repo="$GITHUB_REPOSITORY" \
20+
--title="${TAG#v}" \
21+
--generate-notes \
22+
./lib/*.zip
23+
env:
24+
TAG: ${{ github.event.pull_request.head.sha || github.sha }}
25+
GH_TOKEN: ${{ github.token }}

.github/workflows/test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: 17
17+
registry-url: https://registry.npmjs.org/
18+
- run: npm run bootstrap
19+
- run: npm run lint
20+
- run: npm run build
21+
- run: npm run test

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"build:chrome": "cross-env NODE_ENV=production cross-env NODE_OPTIONS='--openssl-legacy-provider' TARGET_BROWSER=chrome node scripts/webextension/build.js && echo 'Chrome built'",
1212
"start:firefox": "cross-env NODE_ENV=development cross-env TARGET_BROWSER=firefox NODE_OPTIONS='--openssl-legacy-provider' node scripts/webextension/dev-server.js",
1313
"build:firefox": "cross-env NODE_ENV=production TARGET_BROWSER=firefox NODE_OPTIONS='--openssl-legacy-provider' node scripts/webextension/build.js",
14-
"test": "npm run test:unit ; npm run test:e2e",
14+
"test": "npm run test:unit",
1515
"test:unit": "cross-env NODE_ENV=test NODE_OPTIONS='--openssl-legacy-provider' mocha --require 'babel-core/register' 'src/**/*-test.js'",
1616
"test:e2e": "npm run test:e2e:chrome",
1717
"test:e2e:chrome": "cross-env NODE_ENV=test TARGET_BROWSER=chrome NODE_OPTIONS='--openssl-legacy-provider' node scripts/webextension/build.js && npm run test:e2e:chrome:now",

0 commit comments

Comments
 (0)