8000 build: add automate-release · Kikobeats/github-create-secret@90e101c · GitHub
[go: up one dir, main page]

Skip to content

Commit 90e101c

Browse files
committed
build: add automate-release
1 parent 009ea58 commit 90e101c

File tree

3 files changed

+108
-1
lines changed

3 files changed

+108
-1
lines changed

.github/workflows/main.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: main
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
contributors:
10+
if: "${{ github.event.head_commit.message != 'build: contributors' }}"
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: lts/*
22+
- name: Contributors
10000 23+
run: |
24+
git config --global user.email ${{ secrets.GIT_EMAIL }}
25+
git config --global user.name ${{ secrets.GIT_USERNAME }}
26+
npm run contributors
27+
- name: Push changes
28+
run: |
29+
git push origin ${{ github.head_ref }}
30+
31+
release:
32+
if: |
33+
!startsWith(github.event.head_commit.message, 'chore(release):') &&
34+
!startsWith(github.event.head_commit.message, 'docs:') &&
35+
!startsWith(github.event.head_commit.message, 'ci:')
36+
needs: [contributors]
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 2
43+
token: ${{ secrets.GITHUB_TOKEN }}
44+
- name: Setup Node.js
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: lts/*
48+
- name: Setup PNPM
49+
uses: pnpm/action-setup@v2
50+
with:
51+
version: latest
52+
run_install: true
53+
- name: Test
54+
run: pnpm test
55+
# - name: Report
56+
# run: npx c8 report --reporter=text-lcov > coverage/lcov.info
57+
# - name: Coverage
58+
# uses: coverallsapp/github-action@main
59+
# with:
60+
# github-token: ${{ secrets.GITHUB_TOKEN }}
61+
- name: Release
62+
env:
63+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
64+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
65+
run: |
66+
git config --global user.email ${{ secrets.GIT_EMAIL }}
67+
git config --global user.name ${{ secrets.GIT_USERNAME }}
68+
git pull origin master
69+
pnpm run release

.github/workflows/pull_request.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: pull_request
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
test:
13+
if: github.ref != 'refs/heads/master'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: lts/*
24+
- name: Setup PNPM
25+
uses: pnpm/action-setup@v2
26+
with:
27+
version: latest
28+
run_install: true
29+
- name: Test
30+
run: pnpm test
31+
# - name: Report
32+
# run: npx c8 report --reporter=text-lcov > coverage/lcov.info
33+
# - name: Coverage
34+
# uses: coverallsapp/github-action@main
35+
# with:
36+
# github-token: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@
3535
"@commitlint/cli": "latest",
3636
"@commitlint/config-conventional": "latest",
3737
"@ksmithut/prettier-standard": "latest",
38+
"ci-publish": "latest",
3839
"finepack": "latest",
3940
"git-authors-cli": "latest",
4041
"github-generate-release": "latest",
4142
"nano-staged": "latest",
4243
"npm-check-updates": "latest",
4344
"simple-git-hooks": "latest",
4445
"standard": "latest",
46+
"standard-markdown": "latest",
4547
"standard-version": "latest"
4648
},
4749
"engines": {
@@ -56,7 +58,7 @@
5658
"contributors": "(npx git-authors-cli && npx finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true",
5759
"coverage": "c8 report --reporter=text-lcov > coverage/lcov.info",
5860
"lint": "standard",
59-
"postrelease": "npm run release:tags && npm run release:github && npm publish",
61+
"postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
6062
"prerelease": "npm run update:check",
6163
"pretest": "npm run lint",
6264
"release": "standard-version -a",

0 commit comments

Comments
 (0)
0