Skip to content

Commit

Permalink
chore: add github workflow release.yml (#1243)
Browse files Browse the repository at this point in the history
* chore: add github workflow  release.yml

* chore: add snyk_token to yml

* chore: remove snyk_token

* chore: remove snyk_token

* chore: remove snyk_token

* chore: test puppeteer

* chore: test puppeteer

* chore: test puppeteer

* chore: test master.yml

* chore: set npm version

* chore: set puppeteer version

* chore: set puppeteer version

---------

Co-authored-by: csg01123119 <csg01123119@alibaba-inc.com>
Co-authored-by: YunZZY <1263206327@qq.com>
  • Loading branch information
3 people authored Sep 6, 2023
1 parent 13a2691 commit 2bdd51b
Show file tree
Hide file tree
Showing 12 changed files with 23,833 additions and 14,904 deletions.
1 change: 1 addition & 0 deletions .github/workflows/codeCov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
ALI_SDK_STS_REGION: ${{secrets.ALI_SDK_STS_REGION}}
ALI_SDK_STS_ROLE: ${{secrets.ALI_SDK_STS_ROLE}}
ALI_SDK_STS_SECRET: ${{secrets.ALI_SDK_STS_SECRET}}

steps:
- uses: actions/checkout@v2
- name: test and report upload
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/dev_node_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ jobs:

steps:
- uses: actions/checkout@v2
with:
ref: develop
- name: browser build and test
run: |
curl cip.cc
Expand Down Expand Up @@ -64,8 +62,6 @@ jobs:

steps:
- uses: actions/checkout@v2
with:
ref: develop
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
Expand Down Expand Up @@ -97,8 +93,6 @@ jobs:

steps:
- uses: actions/checkout@v2
with:
ref: develop
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/master_node_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install -D npm@6.14.12
- run: npm install
- run: npm run test

Expand Down Expand Up @@ -97,6 +98,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install -D npm@6.14.16
- run: npm install
- run: npm run test

Expand Down Expand Up @@ -128,5 +130,6 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install -D npm@6.14.18
- run: npm install
- run: npm run test
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
push:
branches:
- release
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
# https://docs.github.com/zh/actions/using-jobs/assigning-permissions-to-jobs
contents: write # 为 GITHUB_TOKEN 授予更新tag的权限
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} # semantic-release和create-pull-request.js需要
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # 只有semantic-release需要

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 18
- name: Install Dependencies
run: npm install
- name: Snyk Protect
run: npm run snyk-protect
- name: Release to npm
run: npx semantic-release
# - name: Publish to cdn
# run: node publish.js # 因为发cdn 的ak权限比较大,有安全风险,故需要在本地发版到cdn
# 为了创建pr,GIT_TOKEN需要public_repo权限(https://github.com/settings/tokens/new)
- name: Create Pull Request
run: node ./task/create-pull-request.js
1 change: 1 addition & 0 deletions .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
security:
environment: ali_oss_AK
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
dist/
31 changes: 31 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"branches": "release",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github",
[
"@semantic-release/npm",
{
"npmPublish": true
}
],
[
"@semantic-release/exec",
{
"prepareCmd": "npm run build-dist"
}
],
[
"@semantic-release/git",
{
"assets": [
"package.json",
"lib/browser/version.js",
"dist/*.js"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
2 changes: 1 addition & 1 deletion browser-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function build(options, callback) {
options = {};
}

console.error('Building with options: %j', options);
console.error('Building with options: %j %j', options, pkg.version);

const verStr = `exports.version = '${pkg.version}';`;
fs.writeFileSync(path.resolve(__dirname + '/lib/browser/version.js'), verStr);
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
module.exports = { extends: ['@commitlint/config-conventional'], ignores: [message => /\[skip ci\]/m.test(message)] };
Loading

0 comments on commit 2bdd51b

Please sign in to comment.