From 2b66a034348019ccf30c30c864a91c3010e2a061 Mon Sep 17 00:00:00 2001 From: Seungwoo321 Date: Mon, 12 May 2025 17:00:30 +0900 Subject: [PATCH 1/3] ci: remoe sync workflows and create release pr --- .github/workflows/create-release-pr.yml | 64 +++++++++++++++++++++++ .github/workflows/sync-vue-pivottable.yml | 43 --------------- 2 files changed, 64 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/create-release-pr.yml delete mode 100644 .github/workflows/sync-vue-pivottable.yml diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml new file mode 100644 index 0000000..a1dd4c5 --- /dev/null +++ b/.github/workflows/create-release-pr.yml @@ -0,0 +1,64 @@ +name: Create Release PR + +on: + push: + branches: + - main + +jobs: + create-release-pr: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Generate GitHub App Token + id: generate-token + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} + installation_id: ${{ secrets.APP_INSTALLATION_ID }} + + - name: Create Release PR Branch + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + + # 현재 날짜와 시간을 포함한 고유한 브랜치 이름 생성 + BRANCH_NAME="sync-main-to-release-$(date +'%Y%m%d-%H%M%S')" + git checkout -b $BRANCH_NAME + + # GitHub App 토큰을 사용하여 브랜치 푸시 + git remote set-url origin https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com/${{ github.repository }} + git push origin $BRANCH_NAME + + # 변경 내용 요약 + COMMIT_MESSAGE=$(git log -1 --pretty=%B) + echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV + echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> $GITHUB_ENV + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ steps.generate-token.outputs.token }} + base: release + branch: ${{ env.BRANCH_NAME }} + title: 'chore: sync main to release' + body: | + 이 PR은 메인 브랜치의 변경사항을 릴리즈 브랜치로 동기화합니다. + + ## 주요 변경사항: + ${{ env.COMMIT_MESSAGE }} + + 이 PR이 머지되면 릴리즈 워크플로우가 자동으로 트리거됩니다. + labels: | + automated-pr + sync-to-release diff --git a/.github/workflows/sync-vue-pivottable.yml b/.github/workflows/sync-vue-pivottable.yml deleted file mode 100644 index 5d25d96..0000000 --- a/.github/workflows/sync-vue-pivottable.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Sync Release Branch - -on: - push: - branches: - - main - -jobs: - sync-release: - runs-on: ubuntu-latest - permissions: - contents: write - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Generate GitHub App Token - id: generate-token - uses: tibdex/github-app-token@v1 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.APP_PRIVATE_KEY }} - installation_id: ${{ secrets.APP_INSTALLATION_ID }} - - - name: Update or create release branch - run: | - git config --global user.name "GitHub Actions" - git config --global user.email "actions@github.com" - - if git ls-remote --exit-code --heads origin release; then - git fetch origin release - git checkout -b release origin/release - git merge --no-edit origin/main - else - git checkout -b release - fi - - git remote set-url origin https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com/${{ github.repository }} - git push origin release From 0a3449f81b6d711357e0e8ca8bea1ca841ce03f5 Mon Sep 17 00:00:00 2001 From: Seungwoo321 Date: Mon, 12 May 2025 17:03:35 +0900 Subject: [PATCH 2/3] ci: update workflows --- .github/workflows/create-release-pr.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml index a1dd4c5..7b6cf96 100644 --- a/.github/workflows/create-release-pr.yml +++ b/.github/workflows/create-release-pr.yml @@ -27,12 +27,12 @@ jobs: private_key: ${{ secrets.APP_PRIVATE_KEY }} installation_id: ${{ secrets.APP_INSTALLATION_ID }} - - name: Create Release PR Branch + - name: Create branch and PR run: | git config --global user.name "GitHub Actions" git config --global user.email "actions@github.com" - # 현재 날짜와 시간을 포함한 고유한 브랜치 이름 생성 + # 고유한 브랜치 이름 생성 BRANCH_NAME="sync-main-to-release-$(date +'%Y%m%d-%H%M%S')" git checkout -b $BRANCH_NAME @@ -40,25 +40,26 @@ jobs: git remote set-url origin https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com/${{ github.repository }} git push origin $BRANCH_NAME - # 변경 내용 요약 - COMMIT_MESSAGE=$(git log -1 --pretty=%B) - echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV - echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> $GITHUB_ENV - - name: Create Pull Request + id: create_pr uses: peter-evans/create-pull-request@v5 with: token: ${{ steps.generate-token.outputs.token }} + commit-message: 'chore: sync main to release' + branch: sync-main-to-release-$(date +'%Y%m%d-%H%M%S') + delete-branch: false base: release - branch: ${{ env.BRANCH_NAME }} title: 'chore: sync main to release' body: | 이 PR은 메인 브랜치의 변경사항을 릴리즈 브랜치로 동기화합니다. - ## 주요 변경사항: - ${{ env.COMMIT_MESSAGE }} - 이 PR이 머지되면 릴리즈 워크플로우가 자동으로 트리거됩니다. labels: | automated-pr sync-to-release + + - name: PR Details + if: steps.create_pr.outputs.pull-request-number + run: | + echo "::notice::Pull Request created: #${{ steps.create_pr.outputs.pull-request-number }}" + echo "::notice::View it here: ${{ steps.create_pr.outputs.pull-request-url }}" From 35c687ce4390604d09876f66ff3f3ef7dd018dd6 Mon Sep 17 00:00:00 2001 From: Seungwoo321 Date: Mon, 12 May 2025 17:06:06 +0900 Subject: [PATCH 3/3] ci: update workflows --- .github/workflows/create-release-pr.yml | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml index 7b6cf96..44777c9 100644 --- a/.github/workflows/create-release-pr.yml +++ b/.github/workflows/create-release-pr.yml @@ -27,28 +27,12 @@ jobs: private_key: ${{ secrets.APP_PRIVATE_KEY }} installation_id: ${{ secrets.APP_INSTALLATION_ID }} - - name: Create branch and PR - run: | - git config --global user.name "GitHub Actions" - git config --global user.email "actions@github.com" - - # 고유한 브랜치 이름 생성 - BRANCH_NAME="sync-main-to-release-$(date +'%Y%m%d-%H%M%S')" - git checkout -b $BRANCH_NAME - - # GitHub App 토큰을 사용하여 브랜치 푸시 - git remote set-url origin https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com/${{ github.repository }} - git push origin $BRANCH_NAME - - name: Create Pull Request - id: create_pr uses: peter-evans/create-pull-request@v5 with: token: ${{ steps.generate-token.outputs.token }} - commit-message: 'chore: sync main to release' - branch: sync-main-to-release-$(date +'%Y%m%d-%H%M%S') - delete-branch: false base: release + branch: main title: 'chore: sync main to release' body: | 이 PR은 메인 브랜치의 변경사항을 릴리즈 브랜치로 동기화합니다. @@ -57,9 +41,3 @@ jobs: labels: | automated-pr sync-to-release - - - name: PR Details - if: steps.create_pr.outputs.pull-request-number - run: | - echo "::notice::Pull Request created: #${{ steps.create_pr.outputs.pull-request-number }}" - echo "::notice::View it here: ${{ steps.create_pr.outputs.pull-request-url }}"