init
Auto Bump and Publish / bump-and-publish (push) Failing after 8m24s
CI / lint-and-test (20) (push) Successful in 1m1s
CI / lint-and-test (22) (push) Successful in 1m3s

This commit is contained in:
Tom You
2026-06-11 15:16:51 +09:00
commit 083505c952
30 changed files with 8530 additions and 0 deletions
+107
View File
@@ -0,0 +1,107 @@
name: Auto Bump and Publish
on:
push:
branches:
- main
workflow_dispatch:
inputs:
bump:
description: Version bump type
required: true
default: patch
type: choice
options:
- patch
- minor
- major
permissions:
contents: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
bump-and-publish:
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
steps:
- name: Determine bump type
id: bump_type
run: echo "value=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.bump || 'patch' }}" >> "$GITHUB_OUTPUT"
- name: Wait 5 minutes for more commits
if: github.event_name != 'workflow_dispatch'
run: sleep 300
- name: Checkout latest branch
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: npm ci
- name: Sync version with npm registry
id: sync
run: |
# npm 레지스트리에 이미 publish된 최신 버전을 확인하여
# 로컬 package.json과 불일치하면 동기화한다.
# (이전 CI에서 publish 성공 후 commit이 실패한 경우 발생)
LOCAL=$(node -p "require('./package.json').version")
REMOTE=$(npm view damn-my-slow-skt version 2>/dev/null || echo "0.0.0")
echo "local=$LOCAL remote=$REMOTE"
if npx semver "$REMOTE" -r ">$LOCAL" > /dev/null 2>&1; then
echo "⚠️ npm registry ($REMOTE) > local ($LOCAL). Syncing..."
npm version "$REMOTE" --no-git-tag-version --allow-same-version
fi
- name: Bump version
id: bump
run: |
npm version ${{ steps.bump_type.outputs.value }} --no-git-tag-version
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Build
run: npm run build
- name: Commit and push version bump
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add package.json package-lock.json 2>/dev/null || true
if git diff --cached --quiet; then
echo "No changes to commit."
else
git commit -m "chore: auto bump ${{ steps.bump_type.outputs.value }} to v${{ steps.bump.outputs.version }}"
git push origin HEAD:${{ github.ref_name }}
fi
- name: Publish to npm (Trusted Publishers OIDC)
run: npm publish --provenance --access public
- name: Tag and release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag "v${{ steps.bump.outputs.version }}"
git push origin "v${{ steps.bump.outputs.version }}"
gh release create "v${{ steps.bump.outputs.version }}" --generate-notes
+41
View File
@@ -0,0 +1,41 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
lint-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20, 22]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- name: Type check
run: npm run typecheck
- name: Lint
run: npm run lint
- name: Build
run: npm run build
- name: Test
run: npm test