Skip to content

Commit

Permalink
chore: create .github related files
Browse files Browse the repository at this point in the history
  • Loading branch information
lumirlumir committed Dec 1, 2024
1 parent 0083448 commit 32c6e75
Show file tree
Hide file tree
Showing 11 changed files with 441 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @lumirlumir
28 changes: 28 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 2
updates:
# Maintain dependencies for npm.
- package-ecosystem: 'npm'
# Specify all directories from the current layer and below recursively, using globstar, for locations of manifest files.
directories:
- '**/*'
ignore:
- dependency-name: 'eslint'
versions: ['9']
schedule:
interval: 'daily'
time: '10:00'
timezone: 'Asia/Seoul'
pull-request-branch-name:
separator: '-'

# Maintain dependencies for GitHub Actions.
- package-ecosystem: 'github-actions'
# Workflow files stored in the default location of `.github/workflows`. (You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.)
directory: '/'
schedule:
interval: 'weekly'
day: 'monday'
time: '10:00'
timezone: 'Asia/Seoul'
pull-request-branch-name:
separator: '-'
52 changes: 52 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# https://github.com/jimschubert/labeler-action

enable:
issues: false
prs: true

comments:
prs: 'Labels have been automatically applied based on the [conventional commit types](https://www.conventionalcommits.org/en/v1.0.0/).🏷️'

labels:
'build':
include:
- '^build\b'
'chore':
include:
- '^chore\b'
'ci':
include:
- '^ci\b'
'design':
include:
- '^design\b'
'docs':
include:
- '^docs\b'
'feat':
include:
- '^feat\b'
'fix':
include:
- '^fix\b'
'perf':
include:
- '^perf\b'
'refactor':
include:
- '^refactor\b'
'remove':
include:
- '^remove\b'
'rename':
include:
- '^rename\b'
'style':
include:
- '^style\b'
'test':
include:
- '^test\b'
'release':
include:
- '^release\b'
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
71 changes: 71 additions & 0 deletions .github/sync-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
lumirlumir/lumirlumir-configs:
- source: ./.github/sync-client.yml
dest: ./clients/npm-bananass.yml
# ./.github/ISSUE_TEMPLATE
- source: ./.github/ISSUE_TEMPLATE/1-bug.md
dest: ./configs/.github/ISSUE_TEMPLATE/1-bug.md
- source: ./.github/ISSUE_TEMPLATE/2-suggestion.md
dest: ./configs/.github/ISSUE_TEMPLATE/2-suggestion.md
- source: ./.github/ISSUE_TEMPLATE/3-others.md
dest: ./configs/.github/ISSUE_TEMPLATE/3-others.md
# ./.github/workflows
- source: ./.github/workflows/bump.yml
dest: ./configs/.github/workflows/monorepo-bump.yml
- source: ./.github/workflows/labeler.yml
dest: ./configs/.github/workflows/labeler.yml
- source: ./.github/workflows/lint.yml
dest: ./configs/.github/workflows/lint.yml
- source: ./.github/workflows/publish.yml
dest: ./configs/.github/workflows/publish.yml
- source: ./.github/workflows/sync-client.yml
dest: ./configs/.github/workflows/sync-client.yml
- source: ./.github/workflows/test.yml
dest: ./configs/.github/workflows/test.yml
# ./.github
- source: ./.github/CODEOWNERS
dest: ./configs/.github/CODEOWNERS
- source: ./.github/dependabot.yml
dest: ./configs/.github/dependabot.yml
- source: ./.github/FUNDING.yml
dest: ./configs/.github/FUNDING.yml
- source: ./.github/labeler.yml
dest: ./configs/.github/labeler.yml
- source: ./.github/PULL_REQUEST_TEMPLATE.md
dest: ./configs/.github/PULL_REQUEST_TEMPLATE.md
- source: ./.github/release.yml
dest: ./configs/.github/release.yml
# ./.husky
- source: ./.husky/pre-commit
dest: ./configs/.husky/pre-commit
# ./.vscode
- source: ./.vscode/extensions.json
dest: ./configs/.vscode/npm-extensions.json
- source: ./.vscode/settings.json
dest: ./configs/.vscode/settings.json
# ./
- source: ./.editorconfig
dest: ./configs/.editorconfig
- source: ./.eslintignore
dest: ./configs/.eslintignore
- source: ./.eslintrc.js
dest: ./configs/.eslintrc.js
- source: ./.gitignore
dest: ./configs/.gitignore
- source: ./.markdownlint.json
dest: ./configs/.markdownlint.json
- source: ./.markdownlintignore
dest: ./configs/.markdownlintignore
- source: ./.nvmrc
dest: ./configs/.nvmrc
- source: ./.prettierignore
dest: ./configs/.prettierignore
- source: ./.prettierrc.js
dest: ./configs/.prettierrc.js
- source: ./babel.config.js
dest: ./configs/babel.config.js
- source: ./CODE_OF_CONDUCT.md
dest: ./configs/CODE_OF_CONDUCT.md
- source: ./LICENSE.md
dest: ./configs/LICENSE.md
- source: ./VScode.code-workspace
dest: ./configs/VScode.code-workspace
81 changes: 81 additions & 0 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
on:
workflow_dispatch:
inputs:
type:
description: Select the type of version bump
required: true
type: choice
default: patch
options:
- patch
- minor
- major
- prerelease
- prepatch
- preminor
- premajor

jobs:
bump:
runs-on: ubuntu-latest

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

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('./lerna.json').version")" >> $GITHUB_ENV
- name: Set up git
run: |
git config --global user.name '루밀LuMir'
git config --global user.email '[email protected]'
git switch -c release-${{ inputs.type }}-${{ env.SHORT_SHA }}
- name: Bump version(patch, minor, major)
if: ${{ inputs.type == 'patch' || inputs.type == 'minor' || inputs.type == 'major' }}
run: |
npx lerna version ${{ inputs.type }} -m "release(${{ inputs.type }}): %s" --no-push --no-private --yes
- name: Bump version(prerelease, prepatch, preminor, premajor)
if: ${{ inputs.type == 'prerelease' || inputs.type == 'prepatch' || inputs.type == 'preminor' || inputs.type == 'premajor' }}
run: |
npx lerna version ${{ inputs.type }} -m "release(${{ inputs.type }}): %s" --preid canary --no-push --no-private --yes
- name: Set up environment variables
run: echo "NEW_VERSION=$(node -p "require('./lerna.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"
15 changes: 15 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: labeler

on:
pull_request_target:
types: [opened]

jobs:
labeler:
runs-on: ubuntu-latest

steps:
- name: Labeler
uses: jimschubert/labeler-action@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: lint

on:
push:
branches: [main]

pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest

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: Lint
run: npm run lint
37 changes: 37 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: publish

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest

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
registry-url: https://registry.npmjs.org

- 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: Test
run: npm run test

- name: Publish
run: npm run publish-package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading

0 comments on commit 32c6e75

Please sign in to comment.