Skip to content

Commit 7f38e18

Browse files
authored
Merge pull request #1 from uploadcare/chore/shipjs
chore: shipjs
2 parents af9c418 + f25c238 commit 7f38e18

File tree

5 files changed

+1530
-39
lines changed

5 files changed

+1530
-39
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Ship js Manual Prepare
2+
on:
3+
issue_comment:
4+
types: [created]
5+
jobs:
6+
manual_prepare:
7+
if: |
8+
github.event_name == 'issue_comment' &&
9+
(github.event.comment.author_association == 'member' || github.event.comment.author_association == 'owner') &&
10+
startsWith(github.event.comment.body, '@shipjs prepare')
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
ref: main
17+
- uses: actions/setup-node@v1
18+
- run: |
19+
if [ -f "yarn.lock" ]; then
20+
yarn install
21+
else
22+
npm install
23+
fi
24+
- run: |
25+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
26+
git config --global user.name "github-actions[bot]"
27+
- run: npm run release -- --yes --no-browse
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }}
31+
32+
create_done_comment:
33+
if: success()
34+
needs: manual_prepare
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/github-script@v3
38+
with:
39+
github-token: ${{ secrets.GITHUB_TOKEN }}
40+
script: |
41+
github.issues.createComment({
42+
issue_number: context.issue.number,
43+
owner: context.repo.owner,
44+
repo: context.repo.repo,
45+
body: "@${{github.actor}} `shipjs prepare` done"
46+
})
47+
48+
create_fail_comment:
49+
if: cancelled() || failure()
50+
needs: manual_prepare
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/github-script@v3
54+
with:
55+
github-token: ${{ secrets.GITHUB_TOKEN }}
56+
script: |
57+
github.issues.createComment({
58+
issue_number: context.issue.number,
59+
owner: context.repo.owner,
60+
repo: context.repo.repo,
61+
body: "@${{github.actor}} `shipjs prepare` fail"
62+
})

.github/workflows/shipjs-trigger.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Ship js trigger
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
jobs:
7+
build:
8+
name: Release
9+
runs-on: ubuntu-latest
10+
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/v')
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 0
15+
ref: main
16+
- uses: actions/setup-node@v1
17+
with:
18+
registry-url: "https://registry.npmjs.org"
19+
- run: |
20+
if [ -f "yarn.lock" ]; then
21+
yarn install
22+
else
23+
npm install
24+
fi
25+
- run: npx shipjs trigger
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
29+
SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }}

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
"types": "./build/index.d.ts",
77
"module": "./build/index.js",
88
"scripts": {
9-
"lint": "eslint ./src/**/*.{ts,tsx} ./src/*.{ts,tsx}",
10-
"format": "yarn prettier src/*.{ts,tsx} src/**/*.{ts,tsx} --write",
9+
"lint": "eslint ./src/**/*.{ts,tsx}",
10+
"format": "yarn prettier src/**/*.{ts,tsx} --write",
1111
"test": "jest",
1212
"test:coverage": "jest --coverage",
1313
"build": "tsc --project tsconfig.publish.json && ts-add-module-exports",
14-
"prepare": "husky install"
14+
"prepare": "husky install",
15+
"release": "shipjs prepare"
1516
},
1617
"repository": {
1718
"type": "git",
@@ -57,6 +58,7 @@
5758
"prettier": "^2.4.1",
5859
"react": "^17.0.2",
5960
"react-dom": "^17.0.2",
61+
"shipjs": "0.24.0",
6062
"ts-add-module-exports": "^1.0.0",
6163
"ts-node": "^10.2.1",
6264
"typescript": "^4.4.3"

ship.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
publishCommand: ({ defaultCommand, tag }) =>
3+
`${defaultCommand} --access public --tag ${tag}`
4+
};

0 commit comments

Comments
 (0)