backend-prod-deployed #1
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
| # 백엔드 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 |