From 4b58b9ec4734d7fe398f6ab4ed72ad89ca002f2a Mon Sep 17 00:00:00 2001 From: cuisongliu Date: Wed, 15 Oct 2025 19:31:50 +0800 Subject: [PATCH] feat(release): update release workflow to trigger on tag pushes (#6093) --- .github/workflows/cloud-release.yml | 98 ++++++++++------------------- .github/workflows/cloud.yml | 16 +++++ .github/workflows/controllers.yml | 12 ++++ .github/workflows/frontends.yml | 12 ++++ .github/workflows/release.yml | 27 +++----- .github/workflows/services.yml | 13 ++++ .github/workflows/tagpr.yml | 6 ++ .github/workflows/webhooks.yml | 13 ++++ 8 files changed, 114 insertions(+), 83 deletions(-) diff --git a/.github/workflows/cloud-release.yml b/.github/workflows/cloud-release.yml index e64708b95..adeab1645 100644 --- a/.github/workflows/cloud-release.yml +++ b/.github/workflows/cloud-release.yml @@ -1,6 +1,18 @@ name: Release Cloud on: + workflow_call: + inputs: + tag: + description: "Tag for manual release" + required: false + default: "" + type: string + build_offline_tar_only: + description: "Build offline tar only" + required: false + default: false + type: boolean workflow_dispatch: inputs: tag: @@ -27,77 +39,33 @@ permissions: jobs: release-controllers: if: ${{ inputs.build_offline_tar_only == false }} - runs-on: ubuntu-24.04 - steps: - - name: Trigger Cloud Controller Release Workflow(only when tagged) - uses: actions/github-script@v6 - with: - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'controllers.yml', - ref: "refs/tags/${{ github.ref_name }}", - inputs: { - push_image_tag: "${{ github.ref_name }}", - push_image: true - } - }) + uses: ./.github/workflows/controllers.yml + with: + push_image: true + push_image_tag: ${{ inputs.tag }} + secrets: inherit release-frontends: if: ${{ inputs.build_offline_tar_only == false }} - runs-on: ubuntu-24.04 - steps: - - name: Trigger Cloud Frontends Release Workflow(only when tagged) - uses: actions/github-script@v6 - with: - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'frontends.yml', - ref: "refs/tags/${{ github.ref_name }}", - inputs: { - push_image_tag: "${{ github.ref_name }}", - push_image: true - } - }) - + uses: ./.github/workflows/frontends.yml + with: + push_image: true + push_image_tag: ${{ inputs.tag }} + secrets: inherit release-service: if: ${{ inputs.build_offline_tar_only == false }} - runs-on: ubuntu-24.04 - steps: - - name: Trigger Cloud Services Release Workflow(only when tagged) - uses: actions/github-script@v6 - with: - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'services.yml', - ref: "refs/tags/${{ github.ref_name }}", - inputs: { - push_image_tag: "${{ github.ref_name }}", - push_image: true - } - }) + uses: ./.github/workflows/services.yml + with: + push_image: true + push_image_tag: ${{ inputs.tag }} + secrets: inherit + release-webhook: if: ${{ inputs.build_offline_tar_only == false }} - runs-on: ubuntu-24.04 - steps: - - name: Trigger Cloud Services Release Workflow(only when tagged) - uses: actions/github-script@v6 - with: - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'webhooks.yml', - ref: "refs/tags/${{ github.ref_name }}", - inputs: { - push_image_tag: "${{ github.ref_name }}", - push_image: true - } - }) + uses: ./.github/workflows/webhooks.yml + with: + push_image: true + push_image_tag: ${{ inputs.tag }} + secrets: inherit release-cloud: if: ${{ inputs.build_offline_tar_only == false }} needs: diff --git a/.github/workflows/cloud.yml b/.github/workflows/cloud.yml index 7b11e93df..b87498955 100644 --- a/.github/workflows/cloud.yml +++ b/.github/workflows/cloud.yml @@ -66,6 +66,22 @@ jobs: if: ${{ (github.event_name == 'release') ||(github.event_name == 'push') || (inputs.push_image == true) }} runs-on: ubuntu-24.04 steps: + - name: Free Disk Space (Ubuntu) + uses: BRAINSia/free-disk-space@v2 + with: + # this might remove tools that are actually needed, + # if set to "true" but frees about 6 GB + tool-cache: false + + # all of these default to true, but feel free to set to + # "false" if necessary for your workflow + mandb: true + android: true + dotnet: true + haskell: true + large-packages: true + docker-images: true + swap-storage: true - name: Checkout uses: actions/checkout@v4 with: diff --git a/.github/workflows/controllers.yml b/.github/workflows/controllers.yml index 631cab657..924d086e5 100644 --- a/.github/workflows/controllers.yml +++ b/.github/workflows/controllers.yml @@ -1,6 +1,18 @@ name: Build Controllers image on: + workflow_call: + inputs: + push_image: + description: "Push image" + required: false + type: boolean + default: false + push_image_tag: + description: "Push image tag" + default: "latest" + required: false + type: string workflow_dispatch: inputs: push_image: diff --git a/.github/workflows/frontends.yml b/.github/workflows/frontends.yml index 4f0ec079b..09dfc4f22 100644 --- a/.github/workflows/frontends.yml +++ b/.github/workflows/frontends.yml @@ -1,6 +1,18 @@ name: Build Frontends Image on: + workflow_call: + inputs: + push_image: + description: "Push image" + required: false + type: boolean + default: false + push_image_tag: + description: "Push image tag" + default: "latest" + required: false + type: string workflow_dispatch: inputs: push_image: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 941868b9d..d82547ce3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,9 @@ env: on: workflow_dispatch: + push: + tags: + - "*" jobs: releaser: @@ -47,27 +50,15 @@ jobs: USERNAME: ${{ github.repository_owner }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} FURY_TOKEN: ${{ secrets.FURY_TOKEN }} - cloud-release: - runs-on: ubuntu-24.04 + uses: ./.github/workflows/cloud-release.yml needs: - releaser permissions: - contents: read + contents: write packages: write actions: write - steps: - - name: Trigger Cloud Release Workflow(only when tagged) - uses: actions/github-script@v6 - with: - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'cloud-release.yml', - ref: "refs/tags/${{ github.ref_name }}", - inputs: { - tag: "${{ github.ref_name }}", - build_offline_tar_only: false - } - }) \ No newline at end of file + secrets: inherit + with: + tag: ${{ github.ref_name }} + build_offline_tar_only: false \ No newline at end of file diff --git a/.github/workflows/services.yml b/.github/workflows/services.yml index 425a13cf9..6b2091ad3 100644 --- a/.github/workflows/services.yml +++ b/.github/workflows/services.yml @@ -1,6 +1,18 @@ name: Build Services image on: + workflow_call: + inputs: + push_image: + description: "Push image" + required: false + type: boolean + default: false + push_image_tag: + description: "Push image tag" + default: "latest" + required: false + type: string workflow_dispatch: inputs: push_image: @@ -49,6 +61,7 @@ jobs: run: bash scripts/resolve-modules.sh ./service golangci-lint: + if: ${{ github.event_name }} == 'push' || ${{ github.event_name }} == 'pull_request' needs: [resolve-modules] runs-on: ubuntu-24.04 strategy: diff --git a/.github/workflows/tagpr.yml b/.github/workflows/tagpr.yml index 2c411e6da..421d2b8ae 100644 --- a/.github/workflows/tagpr.yml +++ b/.github/workflows/tagpr.yml @@ -38,6 +38,12 @@ jobs: "pre-version": "${PRE_VERSION}" } EOF + env: + VERSION: "${{ inputs.version }}" + PRE_VERSION: "${{ inputs.pre-version }}" + if: ${{ github.event_name == 'workflow_dispatch' }} + name: Add and parse .tagpr.json + - run: | # check if .tagpr.json exists if [ ! -f .tagpr.json ]; then echo "No .tagpr.json file found." diff --git a/.github/workflows/webhooks.yml b/.github/workflows/webhooks.yml index 3ec1cb3c0..0506b4002 100644 --- a/.github/workflows/webhooks.yml +++ b/.github/workflows/webhooks.yml @@ -1,6 +1,18 @@ name: Build Webhooks image on: + workflow_call: + inputs: + push_image: + description: "Push image" + required: false + type: boolean + default: false + push_image_tag: + description: "Push image tag" + default: "latest" + required: false + type: string workflow_dispatch: inputs: push_image: @@ -50,6 +62,7 @@ jobs: run: bash ./scripts/resolve-modules.sh ./webhooks golangci-lint: + if: ${{ github.event_name }} == 'push' || ${{ github.event_name }} == 'pull_request' needs: [ resolve-modules ] runs-on: ubuntu-24.04 strategy: