From dee5ccec9e2cfd53fee725105e032820b1682732 Mon Sep 17 00:00:00 2001 From: zyy17 Date: Fri, 18 Nov 2022 11:48:29 +0800 Subject: [PATCH] ci: add nightly build job (#565) --- .github/workflows/release.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c079cc02c8..ad6034972a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,10 @@ on: push: tags: - "v*.*.*" + schedule: + # At 00:00 Everyday + # https://crontab.guru/every-day-at-midnight + - cron: '0 0 * * *' workflow_dispatch: name: Release @@ -9,6 +13,9 @@ name: Release env: RUST_TOOLCHAIN: nightly-2022-07-14 + # FIXME(zyy17): It's better to fetch the latest tag from git, but for a long time, we will stay at 'v0.1.0-alpha-*' + NIGHTLY_BUILD_VERSION_PREFIX: v0.1.0-alpha + jobs: build: name: Build binary @@ -106,8 +113,25 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v3 + - name: Configure nigthly build version # the version would be ${NIGHTLY_BUILD_VERSION_PREFIX}-YYYYMMDD-nightly, like v0.1.0-alpha-20221119-nightly. + shell: bash + if: github.event_name == 'schedule' + run: | + buildTime=`date "+%Y%m%d"` + NIGHTLY_VERSION=${{ env.NIGHTLY_BUILD_VERSION_PREFIX }}-$buildTime-nigthly + echo "VERSION=${NIGHTLY_VERSION}" >> $GITHUB_ENV + + - name: Publish nigthly release # configure the different release title. + uses: softprops/action-gh-release@v1 + if: github.event_name == 'schedule' + with: + name: "Release ${{ env.NIGHTLY_VERSION }}" + files: | + **/greptime-* + - name: Publish release uses: softprops/action-gh-release@v1 + if: github.event_name != 'schedule' with: name: "Release ${{ github.ref_name }}" files: | @@ -158,8 +182,17 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Configure nigthly build image tag # the tag would be ${NIGHTLY_BUILD_VERSION_PREFIX}-YYYYMMDD-nightly + shell: bash + if: github.event_name == 'schedule' + run: | + buildTime=`date "+%Y%m%d"` + VERSION=${{ env.NIGHTLY_BUILD_VERSION_PREFIX }}-$buildTime-nigthly + echo "VERSION=${VERSION:1}" >> $GITHUB_ENV + - name: Configure tag # If the release tag is v0.1.0, then the image version tag will be 0.1.0. shell: bash + if: github.event_name != 'schedule' run: | VERSION=${{ github.ref_name }} echo "VERSION=${VERSION:1}" >> $GITHUB_ENV