-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (105 loc) · 4.61 KB
/
Copy pathrelease-please.yml
File metadata and controls
118 lines (105 loc) · 4.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Release Please
# 트렁크 기반 릴리즈: main 머지는 Release PR만 갱신하고,
# 그 Release PR을 머지할 때만 실제 릴리즈/발행이 일어난다.
on:
push:
branches: [main]
permissions:
contents: read
concurrency:
group: release-please
cancel-in-progress: false
jobs:
# ── 1) Release PR 유지 / Release PR 머지 시 태그·릴리즈 생성 ──────────
release-please:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
outputs:
release_created: ${{ steps.rp.outputs.release_created }}
tag_name: ${{ steps.rp.outputs.tag_name }}
steps:
# GitHub App 토큰을 써야 Release PR에 CI(verify/CodeRabbit)가 돈다.
# (GITHUB_TOKEN이 만든 PR/커밋은 다른 워크플로를 트리거하지 않음)
- name: GitHub App 토큰 발급
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Release Please
id: rp
uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
with:
token: ${{ steps.app-token.outputs.token }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
# ── 2) 릴리즈 생성됨 → 빌드 & 자산 첨부 & (선택)스토어 발행 ──────────
publish:
needs: release-please
if: needs.release-please.outputs.release_created == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: 리포지토리 체크아웃
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Node.js 설정
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: '20'
cache: npm
- name: 의존성 설치
run: npm ci
- name: 프로덕션 빌드
run: npm run build
- name: dist 압축
env:
TAG: ${{ needs.release-please.outputs.tag_name }}
run: cd dist && zip -r "../dotbugi-${TAG}.zip" .
- name: 릴리즈에 zip 첨부
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ needs.release-please.outputs.tag_name }}
run: gh release upload "$TAG" "dotbugi-${TAG}.zip" --repo "$GITHUB_REPOSITORY" --clobber
# ── Chrome Web Store 자동 게시 (기반 — 기본 비활성) ──────────────
# 활성화: secret(CHROME_CLIENT_ID/SECRET/REFRESH_TOKEN, STABLE_EXTENSION_ID) +
# Variable ENABLE_STORE_PUBLISH=true
- name: Chrome Web Store 게시 (stable)
if: vars.ENABLE_STORE_PUBLISH == 'true'
uses: mnao305/chrome-extension-upload@4008e29e13c144d0f6725462cbd49b7c291b4928 # v5.0.0
with:
file-path: dotbugi-${{ needs.release-please.outputs.tag_name }}.zip
extension-id: ${{ secrets.STABLE_EXTENSION_ID }}
client-id: ${{ secrets.CHROME_CLIENT_ID }}
client-secret: ${{ secrets.CHROME_CLIENT_SECRET }}
refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }}
publish: true
- name: Discord 릴리즈 알림 (스테이블=초록)
if: always() && env.DISCORD_WEBHOOK_URL != ''
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
script: |
const webhook = process.env.DISCORD_WEBHOOK_URL;
if (!webhook) return;
const tag = '${{ needs.release-please.outputs.tag_name }}';
const success = '${{ job.status }}' === 'success';
const url = `https://github.com/${context.repo.owner}/${context.repo.repo}/releases/tag/${tag}`;
const res = await fetch(webhook, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
embeds: [{
title: success ? `✅ 스테이블 릴리즈 ${tag}` : `⚠️ 릴리즈 발행 실패 (${tag})`,
url: success ? url : undefined,
description: success ? '새 버전이 발행되었습니다.' : '워크플로 로그를 확인해주세요.',
color: success ? 0x57f287 : 0xed4245,
}],
}),
});
if (!res.ok) core.warning(`Discord 알림 실패: ${res.status}`);