Skip to content

Commit 6034d21

Browse files
feat(ci): add github action 🏗
1 parent ebfb583 commit 6034d21

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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: master
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:prepare -- --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@master
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
with:
41+
args: comment "@${{ github.actor }} `shipjs prepare` done"
42+
43+
create_fail_comment:
44+
if: cancelled() || failure()
45+
needs: manual_prepare
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/github@master
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
with:
52+
args: comment "@${{ github.actor }} `shipjs prepare` fail"
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+
push:
4+
branches:
5+
- master
6+
jobs:
7+
build:
8+
name: Release
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
ref: master
14+
15+
- uses: actions/setup-node@v1
16+
with:
17+
registry-url: "https://npm.pkg.github.com"
18+
- run: |
19+
if [ -f "yarn.lock" ]; then
20+
yarn install
21+
else
22+
npm install
23+
fi
24+
25+
- run: npm run release:trigger
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }}

0 commit comments

Comments
 (0)