From 62e2a60b7bcf8034e0685b511f3470f067b279a2 Mon Sep 17 00:00:00 2001 From: zyy17 Date: Thu, 16 Mar 2023 17:20:03 +0800 Subject: [PATCH] ci: release artifacts after binary and container is ready (#1192) ci: release artifacts before binary and container is ready --- .github/workflows/release.yml | 93 +++++++++++++++++------------------ 1 file changed, 44 insertions(+), 49 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 23ba61ce46..de0288dfe5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -156,48 +156,6 @@ jobs: with: name: ${{ matrix.file }}.sha256sum path: target/${{ matrix.arch }}/${{ env.CARGO_PROFILE }}/${{ matrix.file }}.sha256sum - release: - name: Release artifacts - needs: [build] - runs-on: ubuntu-latest - if: github.repository == 'GreptimeTeam/greptimedb' - steps: - - name: Checkout sources - uses: actions/checkout@v3 - - - name: Download artifacts - uses: actions/download-artifact@v3 - - - name: Configure scheduled build version # the version would be ${SCHEDULED_BUILD_VERSION_PREFIX}-${SCHEDULED_PERIOD}-YYYYMMDD, like v0.2.0-nigthly-20230313. - shell: bash - if: github.event_name == 'schedule' - run: | - buildTime=`date "+%Y%m%d"` - SCHEDULED_BUILD_VERSION=${{ env.SCHEDULED_BUILD_VERSION_PREFIX }}-${{ env.SCHEDULED_PERIOD }}-$buildTime - echo "SCHEDULED_BUILD_VERSION=${SCHEDULED_BUILD_VERSION}" >> $GITHUB_ENV - - - name: Create scheduled build git tag - if: github.event_name == 'schedule' - run: | - git tag ${{ env.SCHEDULED_BUILD_VERSION }} - - - name: Publish scheduled release # configure the different release title and tags. - uses: softprops/action-gh-release@v1 - if: github.event_name == 'schedule' - with: - name: "Release ${{ env.SCHEDULED_BUILD_VERSION }}" - tag_name: ${{ env.SCHEDULED_BUILD_VERSION }} - generate_release_notes: true - files: | - **/greptime-* - - - name: Publish release - uses: softprops/action-gh-release@v1 - if: github.event_name != 'schedule' - with: - name: "Release ${{ github.ref_name }}" - files: | - **/greptime-* docker: name: Build docker image @@ -208,13 +166,6 @@ jobs: - name: Checkout sources uses: actions/checkout@v3 - - name: Login to UCloud Container Registry - uses: docker/login-action@v2 - with: - registry: uhub.service.ucloud.cn - username: ${{ secrets.UCLOUD_USERNAME }} - password: ${{ secrets.UCLOUD_PASSWORD }} - - name: Login to Dockerhub uses: docker/login-action@v2 with: @@ -293,6 +244,50 @@ jobs: greptime/greptimedb:latest greptime/greptimedb:${{ env.IMAGE_TAG }} + release: + name: Release artifacts + # Release artifacts only when all the artifacts are built successfully. + needs: [build,docker] + runs-on: ubuntu-latest + if: github.repository == 'GreptimeTeam/greptimedb' + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Download artifacts + uses: actions/download-artifact@v3 + + - name: Configure scheduled build version # the version would be ${SCHEDULED_BUILD_VERSION_PREFIX}-${SCHEDULED_PERIOD}-YYYYMMDD, like v0.2.0-nigthly-20230313. + shell: bash + if: github.event_name == 'schedule' + run: | + buildTime=`date "+%Y%m%d"` + SCHEDULED_BUILD_VERSION=${{ env.SCHEDULED_BUILD_VERSION_PREFIX }}-${{ env.SCHEDULED_PERIOD }}-$buildTime + echo "SCHEDULED_BUILD_VERSION=${SCHEDULED_BUILD_VERSION}" >> $GITHUB_ENV + + - name: Create scheduled build git tag + if: github.event_name == 'schedule' + run: | + git tag ${{ env.SCHEDULED_BUILD_VERSION }} + + - name: Publish scheduled release # configure the different release title and tags. + uses: softprops/action-gh-release@v1 + if: github.event_name == 'schedule' + with: + name: "Release ${{ env.SCHEDULED_BUILD_VERSION }}" + tag_name: ${{ env.SCHEDULED_BUILD_VERSION }} + generate_release_notes: true + files: | + **/greptime-* + + - name: Publish release + uses: softprops/action-gh-release@v1 + if: github.event_name != 'schedule' + with: + name: "Release ${{ github.ref_name }}" + files: | + **/greptime-* + docker-push-uhub: name: Push docker image to UCloud Container Registry needs: [docker]