-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecord-backend-prod-release.yml
More file actions
72 lines (62 loc) · 2.36 KB
/
Copy pathrecord-backend-prod-release.yml
File metadata and controls
72 lines (62 loc) · 2.36 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
# 백엔드 prod 배포 fact(repository_dispatch)를 받아 프론트 레포 releases/에 최종 atomic release record를 남긴다.
name: Record Backend Production Release
on:
repository_dispatch:
types:
- backend-prod-deployed
workflow_dispatch:
inputs:
backend_payload_json:
description: 'Backend dispatch wrapper or client_payload JSON for validation/dry-run'
required: true
dry_run:
description: 'true면 record 생성/검증만 하고 commit/push하지 않는다'
required: true
default: 'true'
permissions:
contents: write
concurrency:
group: prod-release-record
cancel-in-progress: false
jobs:
record-backend-release:
runs-on: ubuntu-latest
env:
BACKEND_RELEASE_PAYLOAD_JSON: ${{ github.event_name == 'workflow_dispatch' && inputs.backend_payload_json || toJSON(github.event.client_payload) }}
BACKEND_RELEASE_DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || 'false' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- name: Generate backend release record
run: |
set -euo pipefail
RECORD_PATH="$(node scripts/release/generate-backend-prod-release-record.mjs)"
node scripts/release/validate-release-record.mjs "$RECORD_PATH"
echo "RECORD_PATH=$RECORD_PATH" >> "$GITHUB_ENV"
echo "Generated $RECORD_PATH"
sed -n '1,220p' "$RECORD_PATH"
- name: Upload dry-run release record
if: ${{ env.BACKEND_RELEASE_DRY_RUN == 'true' }}
uses: actions/upload-artifact@v4
with:
name: backend-release-record-dry-run
path: ${{ env.RECORD_PATH }}
if-no-files-found: error
- name: Commit release record
if: ${{ env.BACKEND_RELEASE_DRY_RUN != 'true' }}
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add "$RECORD_PATH"
git commit -m "chore(release): record backend prod release [release-record]"
git pull --rebase origin main
git push origin HEAD:main