Skip to content

Commit 21eeecc

Browse files
committed
chore: publish npm using workflows.
1 parent fc1db9b commit 21eeecc

File tree

2 files changed

+76
-14
lines changed

2 files changed

+76
-14
lines changed

.github/workflows/ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build & Deploy
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
build-deploy:
8+
runs-on: ubuntu-18.04
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: actions/setup-node@v2
12+
with:
13+
node-version: 14
14+
15+
- name: Look Changelog
16+
uses: jaywcjlove/changelog-generator@v1.4.2
17+
with:
18+
token: ${{ secrets.GITHUB_TOKEN }}
19+
filter-author: (jaywcjlove|小弟调调™|dependabot\[bot\]|Renovate Bot)
20+
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'
21+
22+
- run: yarn install
23+
24+
- name: package/react-native-uiw
25+
working-directory: package/react-native-uiw
26+
run: yarn install && yarn run start
27+
28+
- name: Is a tag created auto?
29+
id: create_tag
30+
uses: jaywcjlove/create-tag-action@v1.2.0
31+
with:
32+
token: ${{ secrets.GITHUB_TOKEN }}
33+
package-path: ./package/react-native-uiw/package.json
34+
35+
- name: Generate Changelog
36+
id: changelog
37+
uses: jaywcjlove/changelog-generator@v1.4.2
38+
if: steps.create_tag.outputs.successful
39+
with:
40+
token: ${{ secrets.GITHUB_TOKEN }}
41+
head-ref: ${{ steps.create_tag.outputs.version }}
42+
filter-author: (jaywcjlove|小弟调调™|dependabot\[bot\]|Renovate Bot)
43+
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'
44+
45+
- name: Create Release
46+
uses: ncipollo/release-action@v1
47+
if: steps.create_tag.outputs.successful
48+
with:
49+
token: ${{ secrets.GITHUB_TOKEN }}
50+
name: ${{ steps.changelog.outputs.tag }}
51+
tag: ${{ steps.changelog.outputs.tag }}
52+
body: |
53+
[![](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-native@${{steps.changelog.outputs.version}}/file/README.md) [![npm version](https://img.shields.io/npm/v/@uiw/react-native.svg)](https://www.npmjs.com/package/@uiw/react-native) [![npm bundle size](https://img.shields.io/bundlephobia/minzip/@uiw/react-native)](https://bundlephobia.com/result?p=@uiw/react-native@${{steps.changelog.outputs.version}})
54+
55+
```bash
56+
npm i @uiw/react-native@${{steps.changelog.outputs.version}}
57+
```
58+
59+
${{ steps.changelog.outputs.compareurl }}
60+
${{ steps.changelog.outputs.changelog }}

package/react-native-uiw/script/build.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,22 @@ const tsc = {
7979
}
8080
});
8181
await execute('npm run type');
82-
await execute('npm publish');
83-
await fs.remove(root);
84-
await fs.remove(output);
85-
await fs.remove(tscPath);
86-
await fs.remove(path.join(process.cwd(), 'package-lock.json'));
87-
await fs.remove(path.join(process.cwd(), 'yarn.lock'));
88-
// await fs.remove(path.join(process.cwd(), 'node_modules'));
89-
await execute(`cd ${projectPath} && git add .`);
90-
await execute(
91-
`cd ${projectPath} && git commit -m "released v${pkg.version}"`,
92-
);
93-
await execute(`cd ${projectPath} && git push`);
94-
await execute(`git tag -a v${pkg.version} -m "released v${pkg.version}"`);
95-
await execute('git push --tags');
82+
// use workflows
83+
// -------------
84+
// await execute('npm publish');
85+
// await fs.remove(root);
86+
// await fs.remove(output);
87+
// await fs.remove(tscPath);
88+
// await fs.remove(path.join(process.cwd(), 'package-lock.json'));
89+
// await fs.remove(path.join(process.cwd(), 'yarn.lock'));
90+
// // await fs.remove(path.join(process.cwd(), 'node_modules'));
91+
// await execute(`cd ${projectPath} && git add .`);
92+
// await execute(
93+
// `cd ${projectPath} && git commit -m "released v${pkg.version}"`,
94+
// );
95+
// await execute(`cd ${projectPath} && git push`);
96+
// await execute(`git tag -a v${pkg.version} -m "released v${pkg.version}"`);
97+
// await execute('git push --tags');
9698
} catch (err) {
9799
console.log(err);
98100
}

0 commit comments

Comments
 (0)