Skip to content

Commit

Permalink
Merge pull request #2 from microlinkhq/next
Browse files Browse the repository at this point in the history
ci: add automate release
  • Loading branch information
Kikobeats authored Aug 1, 2024
2 parents 1372b6a + 7683d34 commit e563416
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 2 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: main

on:
push:
branches:
- master

jobs:
contributors:
if: "${{ github.event.head_commit.message != 'build: contributors' }}"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Contributors
run: |
git config --global user.email ${{ secrets.GIT_EMAIL }}
git config --global user.name ${{ secrets.GIT_USERNAME }}
npm run contributors
- name: Push changes
run: |
git push origin ${{ github.head_ref }}
release:
if: |
!startsWith(github.event.head_commit.message, 'chore(release):') &&
!startsWith(github.event.head_commit.message, 'docs:') &&
!startsWith(github.event.head_commit.message, 'ci:')
needs: [contributors]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: latest
run_install: true
- name: Test
run: pnpm test
- name: Report
run: npx c8 report --reporter=text-lcov > coverage/lcov.info
- name: Coverage
uses: coverallsapp/github-action@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
git config --global user.email ${{ secrets.GIT_EMAIL }}
git config --global user.name ${{ secrets.GIT_USERNAME }}
git pull origin master
pnpm run release
36 changes: 36 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: pull_request

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
if: github.ref != 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: latest
run_install: true
- name: Test
run: pnpm test
- name: Report
run: npx c8 report --reporter=text-lcov > coverage/lcov.info
- name: Coverage
uses: coverallsapp/github-action@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
"@ksmithut/prettier-standard": "latest",
"ava": "latest",
"c8": "latest",
"ci-publish": "latest",
"finepack": "latest",
"git-authors-cli": "latest",
"github-generate-release": "latest",
"nano-staged": "latest",
"npm-check-updates": "latest",
"pretty-ms": "7",
"simple-git-hooks": "latest",
"standard": "latest",
"standard-markdown": "latest",
Expand All @@ -63,7 +63,7 @@
"contributors": "(npx git-authors-cli && npx finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true",
"coverage": "c8 report --reporter=text-lcov > coverage/lcov.info",
"lint": "standard-markdown README.md && standard",
"postrelease": "npm run release:tags && npm run release:github && npm publish",
"postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
"prerelease": "npm run update:check",
"pretest": "npm run lint",
"release": "standard-version -a",
Expand Down

0 comments on commit e563416

Please sign in to comment.