From d7aeb369a6891e9e245018438bba41afc359b72d Mon Sep 17 00:00:00 2001 From: zyy17 Date: Wed, 11 Oct 2023 11:42:04 +0800 Subject: [PATCH] refactor: add new action 'release-cn-artifacts' (#2554) * refactor: add new action 'release-cn-artifacts' * refactor: refine naming: 'release-artifacts' -> 'publish-github-release' Signed-off-by: zyy17 --------- Signed-off-by: zyy17 --- .../actions/build-greptime-binary/action.yml | 36 ----- .../actions/build-macos-artifacts/action.yml | 21 --- .../action.yml | 4 +- .../actions/release-cn-artifacts/action.yaml | 138 ++++++++++++++++++ .github/actions/upload-artifacts/action.yml | 74 ---------- .github/workflows/dev-build.yml | 29 ++-- .github/workflows/nightly-build.yml | 28 ++-- .github/workflows/release.yml | 42 ++---- 8 files changed, 178 insertions(+), 194 deletions(-) rename .github/actions/{release-artifacts => publish-github-release}/action.yml (96%) create mode 100644 .github/actions/release-cn-artifacts/action.yaml diff --git a/.github/actions/build-greptime-binary/action.yml b/.github/actions/build-greptime-binary/action.yml index a55601c17708..8a06dd2231e3 100644 --- a/.github/actions/build-greptime-binary/action.yml +++ b/.github/actions/build-greptime-binary/action.yml @@ -16,30 +16,6 @@ inputs: version: description: Version of the artifact required: true - release-to-s3-bucket: - description: S3 bucket to store released artifacts - required: true - aws-access-key-id: - description: AWS access key id - required: true - aws-secret-access-key: - description: AWS secret access key - required: true - aws-region: - description: AWS region - required: true - upload-to-s3: - description: Upload to S3 - required: false - default: 'true' - upload-latest-artifacts: - description: Upload the latest artifacts to S3 - required: false - default: 'true' - build-android-artifacts: - description: Build android artifacts - required: false - default: 'false' working-dir: description: Working directory to build the artifacts required: false @@ -64,12 +40,6 @@ runs: artifacts-dir: ${{ inputs.artifacts-dir }} target-file: ./target/${{ inputs.cargo-profile }}/greptime version: ${{ inputs.version }} - release-to-s3-bucket: ${{ inputs.release-to-s3-bucket }} - aws-access-key-id: ${{ inputs.aws-access-key-id }} - aws-secret-access-key: ${{ inputs.aws-secret-access-key }} - aws-region: ${{ inputs.aws-region }} - upload-to-s3: ${{ inputs.upload-to-s3 }} - upload-latest-artifacts: ${{ inputs.upload-latest-artifacts }} working-dir: ${{ inputs.working-dir }} # TODO(zyy17): We can remove build-android-artifacts flag in the future. @@ -86,10 +56,4 @@ runs: artifacts-dir: ${{ inputs.artifacts-dir }} target-file: ./target/aarch64-linux-android/release/greptime version: ${{ inputs.version }} - release-to-s3-bucket: ${{ inputs.release-to-s3-bucket }} - aws-access-key-id: ${{ inputs.aws-access-key-id }} - aws-secret-access-key: ${{ inputs.aws-secret-access-key }} - aws-region: ${{ inputs.aws-region }} - upload-to-s3: ${{ inputs.upload-to-s3 }} - upload-latest-artifacts: ${{ inputs.upload-latest-artifacts }} working-dir: ${{ inputs.working-dir }} diff --git a/.github/actions/build-macos-artifacts/action.yml b/.github/actions/build-macos-artifacts/action.yml index 3b9488edd9f3..6b1cf6b03ba8 100644 --- a/.github/actions/build-macos-artifacts/action.yml +++ b/.github/actions/build-macos-artifacts/action.yml @@ -19,25 +19,9 @@ inputs: disable-run-tests: description: Disable running integration tests required: true - release-to-s3-bucket: - description: S3 bucket to store released artifacts - required: true artifacts-dir: description: Directory to store artifacts required: true - aws-access-key-id: - description: AWS access key id - required: true - aws-secret-access-key: - description: AWS secret access key - required: true - aws-region: - description: AWS region - required: true - upload-to-s3: - description: Upload to S3 - required: false - default: 'true' runs: using: composite steps: @@ -103,8 +87,3 @@ runs: artifacts-dir: ${{ inputs.artifacts-dir }} target-file: target/${{ inputs.arch }}/${{ inputs.cargo-profile }}/greptime version: ${{ inputs.version }} - release-to-s3-bucket: ${{ inputs.release-to-s3-bucket }} - aws-access-key-id: ${{ inputs.aws-access-key-id }} - aws-secret-access-key: ${{ inputs.aws-secret-access-key }} - aws-region: ${{ inputs.aws-region }} - upload-to-s3: ${{ inputs.upload-to-s3 }} diff --git a/.github/actions/release-artifacts/action.yml b/.github/actions/publish-github-release/action.yml similarity index 96% rename from .github/actions/release-artifacts/action.yml rename to .github/actions/publish-github-release/action.yml index 4b139ead5535..d9e172c68452 100644 --- a/.github/actions/release-artifacts/action.yml +++ b/.github/actions/publish-github-release/action.yml @@ -1,5 +1,5 @@ -name: Release artifacts -description: Release artifacts +name: Publish GitHub release +description: Publish GitHub release inputs: version: description: Version to release diff --git a/.github/actions/release-cn-artifacts/action.yaml b/.github/actions/release-cn-artifacts/action.yaml new file mode 100644 index 000000000000..653d6a269462 --- /dev/null +++ b/.github/actions/release-cn-artifacts/action.yaml @@ -0,0 +1,138 @@ +name: Release CN artifacts +description: Release artifacts to CN region +inputs: + image-registry: + description: The image registry to store the images + required: true + image-namespace: + description: The namespace of the image registry to store the images + required: true + image-name: + description: The name of the image to build + required: false + default: greptimedb + image-registry-username: + description: The username to login to the image registry + required: true + image-registry-password: + description: The password to login to the image registry + required: true + version: + description: Version of the artifact + required: true + dev-mode: + description: Enable dev mode, only push standard greptime + required: false + default: 'false' + push-latest-tag: + description: Whether to push the latest tag + required: false + default: 'true' + aws-cn-s3-bucket: + description: S3 bucket to store released artifacts in CN region + required: true + aws-cn-access-key-id: + description: AWS access key id in CN region + required: true + aws-cn-secret-access-key: + description: AWS secret access key in CN region + required: true + aws-cn-region: + description: AWS region in CN + required: true + upload-to-s3: + description: Upload to S3 + required: false + default: 'true' + artifacts-dir: + description: Directory to store artifacts + required: false + default: 'artifacts' + update-latest-version-info: + description: Upload the latest version info in S3 + required: false + default: 'true' + upload-max-retry-times: + description: Max retry times for uploading artifacts to S3 + required: false + default: "20" + upload-retry-timeout: + description: Timeout for uploading artifacts to S3 + required: false + default: "30" # minutes +runs: + using: composite + steps: + - name: Install skopeo + shell: bash + run: | + sudo apt update && sudo apt install -y skopeo + + - name: Push images from Dockerhub to ACR + shell: bash + run: | + skopeo copy -a docker://docker.io/${{ inputs.image-namespace }}/${{ inputs.image-name }}:${{ inputs.version }} \ + --dest-creds "${{ inputs.image-registry-username }}":"${{ inputs.image-registry-password }}" \ + docker://${{ inputs.image-registry }}/${{ inputs.image-namespace }}/${{ inputs.image-name }}:${{ inputs.version }} + + if [[ "${{ inputs.dev-mode }}" == "false" ]]; then + skopeo copy -a docker://docker.io/${{ inputs.image-namespace }}/${{ inputs.image-name }}:${{ inputs.version }} \ + --dest-creds "${{ inputs.image-registry-username }}":"${{ inputs.image-registry-password }}" \ + docker://${{ inputs.image-registry }}/${{ inputs.image-namespace }}/${{ inputs.image-name }}-centos:${{ inputs.version }} + fi + + - name: Push latest images from Dockerhub to ACR + shell: bash + if: ${{ inputs.push-latest-tag == 'true' }} + run: | + skopeo copy -a docker://docker.io/${{ inputs.image-namespace }}/${{ inputs.image-name }}:${{ inputs.version }} \ + --dest-creds "${{ inputs.image-registry-username }}":"${{ inputs.image-registry-password }}" \ + docker://${{ inputs.image-registry }}/${{ inputs.image-namespace }}/${{ inputs.image-name }}:latest + + if [[ "${{ inputs.dev-mode }}" == "false" ]]; then + skopeo copy -a docker://docker.io/${{ inputs.image-namespace }}/${{ inputs.image-name }}:${{ inputs.version }} \ + --dest-creds "${{ inputs.image-registry-username }}":"${{ inputs.image-registry-password }}" \ + docker://${{ inputs.image-registry }}/${{ inputs.image-namespace }}/${{ inputs.image-name }}-centos:latest + fi + + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + path: ${{ inputs.artifacts-dir }} + + - name: Upload artifacts to aws-cn S3 + if: ${{ inputs.upload-to-s3 == 'true' }} + uses: nick-invision/retry@v2 + env: + AWS_ACCESS_KEY_ID: ${{ inputs.aws-cn-access-key-id }} + AWS_SECRET_ACCESS_KEY: ${{ inputs.aws-cn-secret-access-key }} + AWS_DEFAULT_REGION: ${{ inputs.aws-cn-region }} + with: + max_attempts: ${{ inputs.upload-max-retry-times }} + timeout_minutes: ${{ inputs.upload-retry-timeout }} + # The bucket layout will be: + # releases/greptimedb + # ├── v0.1.0 + # │ ├── greptime-darwin-amd64-pyo3-v0.1.0.sha256sum + # │ └── greptime-darwin-amd64-pyo3-v0.1.0.tar.gz + # └── v0.2.0 + # ├── greptime-darwin-amd64-pyo3-v0.2.0.sha256sum + # └── greptime-darwin-amd64-pyo3-v0.2.0.tar.gz + command: | + cd ${{ inputs.artifacts-dir }} && \ + aws s3 cp . s3://${{ inputs.aws-cn-s3-bucket }}/releases/greptimedb/${{ inputs.version }} \ + --recursive --exclude "*" --include "greptime-*.tar.gz" --include "greptime-*.sha256sum" + + - name: Update latest version info in aws-cn S3 + if: ${{ inputs.upload-to-s3 == 'true' && inputs.update-latest-version-info == 'true' }} # We'll also upload the latest artifacts to S3 in the scheduled and formal release. + uses: nick-invision/retry@v2 + env: + AWS_ACCESS_KEY_ID: ${{ inputs.aws-cn-access-key-id }} + AWS_SECRET_ACCESS_KEY: ${{ inputs.aws-cn-secret-access-key }} + AWS_DEFAULT_REGION: ${{ inputs.aws-cn-region }} + with: + max_attempts: ${{ inputs.upload-max-retry-times }} + timeout_minutes: ${{ inputs.upload-retry-timeout }} + command: | + echo "${{ inputs.version }}" > ${{ inputs.artifacts-dir }}/latest-version.txt && \ + aws cp ${{ inputs.artifacts-dir }}/latest-version.txt s3://${{ inputs.aws-cn-s3-bucket }}/releases/greptimedb/latest-version.txt diff --git a/.github/actions/upload-artifacts/action.yml b/.github/actions/upload-artifacts/action.yml index 44a603b2b78c..290c9950509b 100644 --- a/.github/actions/upload-artifacts/action.yml +++ b/.github/actions/upload-artifacts/action.yml @@ -10,34 +10,6 @@ inputs: version: description: Version of the artifact required: true - release-to-s3-bucket: - description: S3 bucket to store released artifacts - required: true - aws-access-key-id: - description: AWS access key id - required: true - aws-secret-access-key: - description: AWS secret access key - required: true - aws-region: - description: AWS region - required: true - upload-to-s3: - description: Upload to S3 - required: false - default: 'true' - upload-latest-artifacts: - description: Upload the latest artifacts to S3 - required: false - default: 'true' - upload-max-retry-times: - description: Max retry times for uploading artifacts to S3 - required: false - default: "20" - upload-retry-timeout: - description: Timeout for uploading artifacts to S3 - required: false - default: "30" # minutes working-dir: description: Working directory to upload the artifacts required: false @@ -77,49 +49,3 @@ runs: with: name: ${{ inputs.artifacts-dir }}.sha256sum path: ${{ inputs.working-dir }}/${{ inputs.artifacts-dir }}.sha256sum - - - name: Upload artifacts to S3 - if: ${{ inputs.upload-to-s3 == 'true' }} - uses: nick-invision/retry@v2 - env: - AWS_ACCESS_KEY_ID: ${{ inputs.aws-access-key-id }} - AWS_SECRET_ACCESS_KEY: ${{ inputs.aws-secret-access-key }} - AWS_DEFAULT_REGION: ${{ inputs.aws-region }} - with: - max_attempts: ${{ inputs.upload-max-retry-times }} - timeout_minutes: ${{ inputs.upload-retry-timeout }} - # The bucket layout will be: - # releases/greptimedb - # ├── v0.1.0 - # │ ├── greptime-darwin-amd64-pyo3-v0.1.0.sha256sum - # │ └── greptime-darwin-amd64-pyo3-v0.1.0.tar.gz - # └── v0.2.0 - # ├── greptime-darwin-amd64-pyo3-v0.2.0.sha256sum - # └── greptime-darwin-amd64-pyo3-v0.2.0.tar.gz - command: | - cd ${{ inputs.working-dir }} && \ - aws s3 cp \ - ${{ inputs.artifacts-dir }}.tar.gz \ - s3://${{ inputs.release-to-s3-bucket }}/releases/greptimedb/${{ inputs.version }}/${{ inputs.artifacts-dir }}.tar.gz && \ - aws s3 cp \ - ${{ inputs.artifacts-dir }}.sha256sum \ - s3://${{ inputs.release-to-s3-bucket }}/releases/greptimedb/${{ inputs.version }}/${{ inputs.artifacts-dir }}.sha256sum - - - name: Upload latest artifacts to S3 - if: ${{ inputs.upload-to-s3 == 'true' && inputs.upload-latest-artifacts == 'true' }} # We'll also upload the latest artifacts to S3 in the scheduled and formal release. - uses: nick-invision/retry@v2 - env: - AWS_ACCESS_KEY_ID: ${{ inputs.aws-access-key-id }} - AWS_SECRET_ACCESS_KEY: ${{ inputs.aws-secret-access-key }} - AWS_DEFAULT_REGION: ${{ inputs.aws-region }} - with: - max_attempts: ${{ inputs.upload-max-retry-times }} - timeout_minutes: ${{ inputs.upload-retry-timeout }} - command: | - cd ${{ inputs.working-dir }} && \ - aws s3 cp \ - ${{ inputs.artifacts-dir }}.tar.gz \ - s3://${{ inputs.release-to-s3-bucket }}/releases/greptimedb/latest/${{ inputs.artifacts-dir }}.tar.gz && \ - aws s3 cp \ - ${{ inputs.artifacts-dir }}.sha256sum \ - s3://${{ inputs.release-to-s3-bucket }}/releases/greptimedb/latest/${{ inputs.artifacts-dir }}.sha256sum diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index a0182d19badc..35e9bec323aa 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -198,12 +198,7 @@ jobs: cargo-profile: ${{ env.CARGO_PROFILE }} version: ${{ needs.allocate-runners.outputs.version }} disable-run-tests: ${{ env.DISABLE_RUN_TESTS }} - release-to-s3-bucket: ${{ vars.AWS_RELEASE_BUCKET }} - aws-access-key-id: ${{ secrets.AWS_CN_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_CN_SECRET_ACCESS_KEY }} - aws-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }} dev-mode: true # Only build the standard greptime binary. - upload-to-s3: false # No need to upload to S3. working-dir: ${{ env.CHECKOUT_GREPTIMEDB_PATH }} release-images-to-dockerhub: @@ -239,35 +234,35 @@ jobs: run: | echo "build-result=success" >> $GITHUB_OUTPUT - release-images-to-acr: - name: Build and push images to ACR + release-cn-artifacts: + name: Release artifacts to CN region if: ${{ inputs.release_images || github.event_name == 'schedule' }} needs: [ allocate-runners, - build-linux-amd64-artifacts, - build-linux-arm64-artifacts, + release-images-to-dockerhub, ] runs-on: ubuntu-latest - # When we push to ACR, it's easy to fail due to some unknown network issues. - # However, we don't want to fail the whole workflow because of this. - # The ACR have daily sync with DockerHub, so don't worry about the image not being updated. continue-on-error: true steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Build and push images to ACR - uses: ./.github/actions/build-images + - name: Release artifacts to CN region + uses: ./.github/actions/release-cn-artifacts with: image-registry: ${{ vars.ACR_IMAGE_REGISTRY }} image-namespace: ${{ vars.IMAGE_NAMESPACE }} - image-name: ${{ env.IMAGE_NAME }} image-registry-username: ${{ secrets.ALICLOUD_USERNAME }} image-registry-password: ${{ secrets.ALICLOUD_PASSWORD }} version: ${{ needs.allocate-runners.outputs.version }} - push-latest-tag: false # Don't push the latest tag to registry. - dev-mode: true # Only build the standard images. + aws-cn-s3-bucket: ${{ vars.AWS_RELEASE_BUCKET }} + aws-cn-access-key-id: ${{ secrets.AWS_CN_ACCESS_KEY_ID }} + aws-cn-secret-access-key: ${{ secrets.AWS_CN_SECRET_ACCESS_KEY }} + aws-cn-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }} + dev-mode: true # Only build the standard images(exclude centos images). + push-latest-tag: false # Don't push the latest tag to registry. + update-latest-version-info: false # Don't update the latest version info in S3. stop-linux-amd64-runner: # It's always run as the last job in the workflow to make sure that the runner is released. name: Stop linux-amd64 runner diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 1373ab7833cb..9a436e19660e 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -147,11 +147,6 @@ jobs: cargo-profile: ${{ env.CARGO_PROFILE }} version: ${{ needs.allocate-runners.outputs.version }} disable-run-tests: ${{ env.DISABLE_RUN_TESTS }} - release-to-s3-bucket: ${{ vars.AWS_RELEASE_BUCKET }} - aws-access-key-id: ${{ secrets.AWS_CN_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_CN_SECRET_ACCESS_KEY }} - aws-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }} - upload-latest-artifacts: false build-linux-arm64-artifacts: name: Build linux-arm64 artifacts @@ -171,11 +166,6 @@ jobs: cargo-profile: ${{ env.CARGO_PROFILE }} version: ${{ needs.allocate-runners.outputs.version }} disable-run-tests: ${{ env.DISABLE_RUN_TESTS }} - release-to-s3-bucket: ${{ vars.AWS_RELEASE_BUCKET }} - aws-access-key-id: ${{ secrets.AWS_CN_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_CN_SECRET_ACCESS_KEY }} - aws-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }} - upload-latest-artifacts: false release-images-to-dockerhub: name: Build and push images to DockerHub @@ -208,13 +198,12 @@ jobs: run: | echo "nightly-build-result=success" >> $GITHUB_OUTPUT - release-images-to-acr: - name: Build and push images to ACR + release-cn-artifacts: + name: Release artifacts to CN region if: ${{ inputs.release_images || github.event_name == 'schedule' }} needs: [ allocate-runners, - build-linux-amd64-artifacts, - build-linux-arm64-artifacts, + release-images-to-dockerhub, ] runs-on: ubuntu-latest # When we push to ACR, it's easy to fail due to some unknown network issues. @@ -226,15 +215,20 @@ jobs: with: fetch-depth: 0 - - name: Build and push images to ACR - uses: ./.github/actions/build-images + - name: Release artifacts to CN region + uses: ./.github/actions/release-cn-artifacts with: image-registry: ${{ vars.ACR_IMAGE_REGISTRY }} image-namespace: ${{ vars.IMAGE_NAMESPACE }} image-registry-username: ${{ secrets.ALICLOUD_USERNAME }} image-registry-password: ${{ secrets.ALICLOUD_PASSWORD }} version: ${{ needs.allocate-runners.outputs.version }} - push-latest-tag: false # Don't push the latest tag to registry. + aws-cn-s3-bucket: ${{ vars.AWS_RELEASE_BUCKET }} + aws-cn-access-key-id: ${{ secrets.AWS_CN_ACCESS_KEY_ID }} + aws-cn-secret-access-key: ${{ secrets.AWS_CN_SECRET_ACCESS_KEY }} + aws-cn-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }} + push-latest-tag: false # Don't push the latest tag to registry. + update-latest-version-info: false # Don't update the latest version info in S3. stop-linux-amd64-runner: # It's always run as the last job in the workflow to make sure that the runner is released. name: Stop linux-amd64 runner diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d8e01cade05f..eb69ae99129a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,7 +63,7 @@ on: description: Build macos artifacts required: false default: false - release_artifacts: + publish_github_release: type: boolean description: Create GitHub release and upload artifacts required: false @@ -172,11 +172,6 @@ jobs: cargo-profile: ${{ env.CARGO_PROFILE }} version: ${{ needs.allocate-runners.outputs.version }} disable-run-tests: ${{ env.DISABLE_RUN_TESTS }} - release-to-s3-bucket: ${{ vars.AWS_RELEASE_BUCKET }} - aws-access-key-id: ${{ secrets.AWS_CN_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_CN_SECRET_ACCESS_KEY }} - aws-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }} - upload-to-s3: ${{ vars.UPLOAD_TO_S3 }} build-linux-arm64-artifacts: name: Build linux-arm64 artifacts @@ -196,11 +191,6 @@ jobs: cargo-profile: ${{ env.CARGO_PROFILE }} version: ${{ needs.allocate-runners.outputs.version }} disable-run-tests: ${{ env.DISABLE_RUN_TESTS }} - release-to-s3-bucket: ${{ vars.AWS_RELEASE_BUCKET }} - aws-access-key-id: ${{ secrets.AWS_CN_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_CN_SECRET_ACCESS_KEY }} - aws-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }} - upload-to-s3: ${{ vars.UPLOAD_TO_S3 }} build-macos-artifacts: name: Build macOS artifacts @@ -242,12 +232,7 @@ jobs: features: ${{ matrix.features }} version: ${{ needs.allocate-runners.outputs.version }} disable-run-tests: ${{ env.DISABLE_RUN_TESTS }} - release-to-s3-bucket: ${{ vars.AWS_RELEASE_BUCKET }} artifacts-dir: ${{ matrix.artifacts-dir-prefix }}-${{ needs.allocate-runners.outputs.version }} - aws-access-key-id: ${{ secrets.AWS_CN_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_CN_SECRET_ACCESS_KEY }} - aws-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }} - upload-to-s3: ${{ vars.UPLOAD_TO_S3 }} release-images-to-dockerhub: name: Build and push images to DockerHub @@ -272,15 +257,14 @@ jobs: image-registry-password: ${{ secrets.DOCKERHUB_TOKEN }} version: ${{ needs.allocate-runners.outputs.version }} - release-images-to-acr: - name: Build and push images to ACR + release-cn-artifacts: + name: Release artifacts to CN region if: ${{ inputs.release_images || github.event_name == 'push' || github.event_name == 'schedule' }} needs: [ allocate-runners, - build-linux-amd64-artifacts, - build-linux-arm64-artifacts, + release-images-to-dockerhub, ] - runs-on: ubuntu-2004-16-cores + runs-on: ubuntu-latest # When we push to ACR, it's easy to fail due to some unknown network issues. # However, we don't want to fail the whole workflow because of this. # The ACR have daily sync with DockerHub, so don't worry about the image not being updated. @@ -290,18 +274,22 @@ jobs: with: fetch-depth: 0 - - name: Build and push images to ACR - uses: ./.github/actions/build-images + - name: Release artifacts to CN region + uses: ./.github/actions/release-cn-artifacts with: image-registry: ${{ vars.ACR_IMAGE_REGISTRY }} image-namespace: ${{ vars.IMAGE_NAMESPACE }} image-registry-username: ${{ secrets.ALICLOUD_USERNAME }} image-registry-password: ${{ secrets.ALICLOUD_PASSWORD }} version: ${{ needs.allocate-runners.outputs.version }} + aws-cn-s3-bucket: ${{ vars.AWS_RELEASE_BUCKET }} + aws-cn-access-key-id: ${{ secrets.AWS_CN_ACCESS_KEY_ID }} + aws-cn-secret-access-key: ${{ secrets.AWS_CN_SECRET_ACCESS_KEY }} + aws-cn-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }} - release-artifacts: + publish-github-release: name: Create GitHub release and upload artifacts - if: ${{ inputs.release_artifacts || github.event_name == 'push' || github.event_name == 'schedule' }} + if: ${{ inputs.publish_github_release || github.event_name == 'push' || github.event_name == 'schedule' }} needs: [ allocate-runners, build-linux-amd64-artifacts, @@ -315,8 +303,8 @@ jobs: with: fetch-depth: 0 - - name: Release artifacts - uses: ./.github/actions/release-artifacts + - name: Publish GitHub release + uses: ./.github/actions/publish-github-release with: version: ${{ needs.allocate-runners.outputs.version }}