From 7952a9a744fa3bd229cfa0f8c89d4b18622b1e9b Mon Sep 17 00:00:00 2001 From: wenty22 Date: Wed, 23 Oct 2024 12:09:22 +0800 Subject: [PATCH] chore: Update cicd --- .github/actions/alpha/action.yaml | 4 ++++ .github/workflows/qa-deploy.yaml | 21 ++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/actions/alpha/action.yaml b/.github/actions/alpha/action.yaml index 25e9e7fe..a346369e 100644 --- a/.github/actions/alpha/action.yaml +++ b/.github/actions/alpha/action.yaml @@ -10,6 +10,9 @@ inputs: github-token: description: 'github token' required: true + branch: + description: 'branch' + required: true runs: using: composite @@ -32,6 +35,7 @@ runs: commit: 'chore: Update versions' title: 'chore: Update versions' cwd: '.release' + branch: ${{ inputs.branch }} env: GITHUB_TOKEN: ${{ inputs.github-token }} NPM_TOKEN: ${{ inputs.npm-token }} diff --git a/.github/workflows/qa-deploy.yaml b/.github/workflows/qa-deploy.yaml index 90aa4238..db616ada 100644 --- a/.github/workflows/qa-deploy.yaml +++ b/.github/workflows/qa-deploy.yaml @@ -45,12 +45,6 @@ jobs: - name: get pr env id: pr-env - run: | - BRANCH_NAME=${{ fromJSON(steps.get-pr.outputs.result).head.ref }} - echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT - - - name: get comment - id: get-comment run: | #!/bin/bash input_comment="${{ github.event.comment.body }}" @@ -58,6 +52,9 @@ jobs: APP_NAME=${comment_format#*:} echo "APP_NAME=${APP_NAME}" >> $GITHUB_OUTPUT + BRANCH_NAME=${{ fromJSON(steps.get-pr.outputs.result).head.ref }} + echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT + - name: Checkout code repository uses: actions/checkout@v4 with: @@ -70,7 +67,7 @@ jobs: npm-token: ${{ secrets.NPM_TOKEN }} - name: Deploy github pages - if: contains(steps.get-comment.outputs.APP_NAME, 'canonical-bridge-ui') + if: contains(steps.pr-env.outputs.APP_NAME, 'canonical-bridge-ui') uses: ./.github/actions/gh-pages with: server-endpoint: ${{ vars.SERVER_ENDPOINT }} @@ -78,17 +75,19 @@ jobs: api-token-github: ${{ secrets.API_TOKEN_GITHUB }} - name: Deploy SDK - if: contains(steps.get-comment.outputs.APP_NAME, 'canonical-bridge-sdk') + if: contains(steps.pr-env.outputs.APP_NAME, 'canonical-bridge-sdk') uses: ./.github/actions/alpha with: - app-name: ${{steps.get-comment.outputs.APP_NAME}} + app-name: ${{steps.pr-env.outputs.APP_NAME}} npm-token: ${{ secrets.NPM_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ steps.pr-env.outputs.BRANCH_NAME }} - name: Deploy Widget - if: contains(steps.get-comment.outputs.APP_NAME, 'canonical-bridge-widget') + if: contains(steps.pr-env.outputs.APP_NAME, 'canonical-bridge-widget') uses: ./.github/actions/alpha with: - app-name: ${{steps.get-comment.outputs.APP_NAME}} + app-name: ${{steps.pr-env.outputs.APP_NAME}} npm-token: ${{ secrets.NPM_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ steps.pr-env.outputs.BRANCH_NAME }}