Skip to content

Commit

Permalink
ci: create release related workflows and config files
Browse files Browse the repository at this point in the history
  • Loading branch information
lumirlumir committed Sep 13, 2024
1 parent eed15dc commit 61983c6
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuration-options

changelog:
exclude:
labels:
- release

categories:
- title: 🚀 Features
labels:
- feat

- title: 🐛 Bug Fixes
labels:
- fix

- title: ⚡ Performance
labels:
- perf

- title: ♻️ Refactoring
labels:
- rafactor
- rename
- remove

- title: 🧪 Tests
labels:
- test

- title: ⬆️ Dependency Updates
labels:
- dependencies

- title: 🔄 Continuous Integration
labels:
- build
- ci

- title: 🧰 Maintenance
labels:
- '*'
exclude:
labels:
- feat
- fix
- perf
- refactor
- rename
- remove
- test
- dependencies
- build
- ci
68 changes: 68 additions & 0 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
on:
workflow_dispatch:
inputs:
type:
description: Select the type of version bump
required: true
type: choice
default: patch
options:
- patch
- minor
- major

jobs:
bump:
runs-on: ubuntu-latest

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Set up checkout
uses: actions/checkout@v4

- name: Set up node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm

- name: Set up cache
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

- name: Set up node_modules
run: npm ci

- name: Set up environment variables
run: |
echo "SHORT_SHA=${GITHUB_SHA:0:7}" >> $GITHUB_ENV
echo "OLD_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
- name: Bump
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git switch -c release-${{ inputs.type }}-${{ env.SHORT_SHA }}
npm version ${{ inputs.type }} -m "release(${{ inputs.type }}): v%s"
- name: Set up environment variables
run: echo "NEW_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV

- name: Push
run: git push --set-upstream origin release-${{ inputs.type }}-${{ env.SHORT_SHA }}

- name: Create pull request
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/pulls \
-f "title=release(${{ inputs.type }}): v${{ env.NEW_VERSION }}" \
-f "body=Bump \`${{ github.repository }}\` from v${{ env.OLD_VERSION }} to v${{ env.NEW_VERSION }} :tada:" \
-f "head=${{ github.repository_owner }}:release-${{ inputs.type }}-${{ env.SHORT_SHA }}" \
-f "base=main"
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"private": true,
"version": "0.0.0",
"scripts": {
"prepare": "husky",
"dev": "next dev",
Expand Down

0 comments on commit 61983c6

Please sign in to comment.