Skip to content

Commit

Permalink
feat: add auto CI for version and release
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Nov 24, 2022
1 parent dcbfc2c commit 7e6a687
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: riderx
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build source code and send to Capgo

on:
push:
tags:
- "*"

jobs:
deploy:
runs-on: ubuntu-latest
name: "Build code and release"
steps:
- name: Check out
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
with:
version: 7
- name: Install dependencies
id: install_code
run: pnpm i
- name: Lint
id: lint_code
run: pnpm lint
- name: Build
id: build_code
run: pnpm build
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/bump_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Bump version

on:
push:
branches:
- main
- development

jobs:
bump-version:
if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
runs-on: ubuntu-latest
name: "Bump version and create changelog with standard version"
steps:
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
- name: Git config
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
- name: Create bump and changelog main
if: github.ref == 'refs/heads/main'
run: npx standard-version
- name: Create bump and changelog development
if: github.ref != 'refs/heads/main'
run: npx standard-version --prerelease alpha
- name: Push to origin
run: |
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
remote_repo="https://${GITHUB_ACTOR}:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
git pull $remote_repo $CURRENT_BRANCH
git push $remote_repo HEAD:$CURRENT_BRANCH --follow-tags --tags

0 comments on commit 7e6a687

Please sign in to comment.