fix: 자동 재생 종료 예정 시간 버그 수정 #60
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 버전 관리 및 릴리즈 | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| pull-requests: read | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.merged == true | |
| steps: | |
| - name: 리포지토리 체크아웃 | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Node.js 설정 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: 의존성 설치 | |
| run: npm install | |
| - name: PR 라벨에서 버전 범프 결정 | |
| id: version | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const labels = context.payload.pull_request.labels.map(l => l.name); | |
| let bump = 'patch'; | |
| if (labels.includes('🔖 major')) bump = 'major'; | |
| else if (labels.includes('🔖 minor')) bump = 'minor'; | |
| // 최신 태그에서 현재 버전 추출 | |
| const { execSync } = require('child_process'); | |
| let currentVersion; | |
| try { | |
| const latestTag = execSync('git describe --tags --abbrev=0', { encoding: 'utf-8' }).trim(); | |
| currentVersion = latestTag.replace(/^v/, ''); | |
| } catch { | |
| currentVersion = '0.0.0'; | |
| } | |
| const [major, minor, patch] = currentVersion.split('.').map(Number); | |
| let newVersion; | |
| if (bump === 'major') newVersion = `${major + 1}.0.0`; | |
| else if (bump === 'minor') newVersion = `${major}.${minor + 1}.0`; | |
| else newVersion = `${major}.${minor}.${patch + 1}`; | |
| core.setOutput('new_version', newVersion); | |
| core.setOutput('bump', bump); | |
| - name: package.json 버전 업데이트 | |
| run: npm version ${{ steps.version.outputs.new_version }} --no-git-tag-version | |
| - name: 프로덕션 빌드 | |
| run: npm run build | |
| - name: dist 압축 | |
| run: cd dist && zip -r ../dotbugi-v${{ steps.version.outputs.new_version }}.zip . | |
| - name: README 배지 버전 업데이트 | |
| run: sed -i "s/Chrome_Web_Store-v[0-9]\+\.[0-9]\+\.[0-9]\+/Chrome_Web_Store-v${{ steps.version.outputs.new_version }}/" README.md | |
| - name: 변경사항 커밋 및 태그 | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add package.json package-lock.json README.md | |
| git commit -m "chore: bump version to v${{ steps.version.outputs.new_version }}" | |
| git tag v${{ steps.version.outputs.new_version }} | |
| git push origin main --follow-tags | |
| - name: 릴리즈 노트 생성 | |
| id: changelog | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { execSync } = require('child_process'); | |
| // 이전 태그 찾기 | |
| let prevTag; | |
| try { | |
| prevTag = execSync('git describe --tags --abbrev=0 HEAD~1', { encoding: 'utf-8' }).trim(); | |
| } catch { | |
| prevTag = execSync('git rev-list --max-parents=0 HEAD', { encoding: 'utf-8' }).trim(); | |
| } | |
| const newVersion = '${{ steps.version.outputs.new_version }}'; | |
| // PR에 포함된 커밋 가져오기 | |
| const commits = execSync( | |
| `git log ${prevTag}..HEAD --pretty=format:"- %s (%h)" --no-merges`, | |
| { encoding: 'utf-8' } | |
| ).trim(); | |
| const pr = context.payload.pull_request; | |
| const body = [ | |
| `## What's Changed`, | |
| ``, | |
| `**PR:** #${pr.number} ${pr.title}`, | |
| ``, | |
| `### Commits`, | |
| commits, | |
| ``, | |
| `**Full Changelog:** https://github.com/${context.repo.owner}/${context.repo.repo}/compare/${prevTag}...v${newVersion}`, | |
| ].join('\n'); | |
| core.setOutput('body', body); | |
| - name: GitHub 릴리즈 생성 | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.version.outputs.new_version }} | |
| name: v${{ steps.version.outputs.new_version }} | |
| body: ${{ steps.changelog.outputs.body }} | |
| files: dotbugi-v${{ steps.version.outputs.new_version }}.zip |