Release Images #695
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: RELEASE-IMAGE | |
on: | |
schedule: | |
- cron: '0 0 * * 1-5' # Runs at 00:00 UTC on Mon to Friday | |
workflow_dispatch: | |
inputs: | |
image_tag: | |
description: 'image tag' | |
required: false | |
default: 'latest' | |
release: | |
types: | |
- published | |
env: | |
GH_TOKEN: ${{ github.token }} | |
RELEASE_VERSION: ${{ github.ref_name }} | |
RELEASE_BOT_WEBHOOK: ${{ secrets.RELEASE_BOT_WEBHOOK }} | |
jobs: | |
image-tag: | |
runs-on: ubuntu-latest | |
outputs: | |
tag-name: ${{ steps.get_tag_name.outputs.tag_name }} | |
steps: | |
- name: Get Tag Name | |
id: get_tag_name | |
run: | | |
TAG_NAME="latest" | |
if [[ ! -z "${{ inputs.image_tag }}" ]]; then | |
TAG_NAME="${{ inputs.image_tag }}" | |
elif [[ "${{ env.RELEASE_VERSION }}" == "main" ]]; then | |
TAG_NAME="latest" | |
elif [[ ! -z "${{ env.RELEASE_VERSION }}" ]]; then | |
TAG_NAME=${{ env.RELEASE_VERSION }} | |
fi | |
echo tag_name=$TAG_NAME >> $GITHUB_OUTPUT | |
release-image: | |
needs: image-tag | |
uses: apecloud/apecloud-cd/.github/workflows/[email protected] | |
with: | |
MAKE_OPS_PRE: "generate" | |
IMG: "apecloud/kubeblocks" | |
VERSION: "${{ needs.image-tag.outputs.tag-name }}" | |
GO_VERSION: "1.20.5" | |
APECD_REF: "v0.1.12" | |
DOCKERFILE_PATH: "./docker/Dockerfile" | |
secrets: inherit | |
release-tools-image: | |
needs: image-tag | |
uses: apecloud/apecloud-cd/.github/workflows/[email protected] | |
with: | |
MAKE_OPS_PRE: "generate test-go-generate" | |
IMG: "apecloud/kubeblocks-tools" | |
VERSION: "${{ needs.image-tag.outputs.tag-name }}" | |
GO_VERSION: "1.20.5" | |
APECD_REF: "v0.1.12" | |
DOCKERFILE_PATH: "./docker/Dockerfile-tools" | |
secrets: inherit | |
release-datascript-image: | |
needs: image-tag | |
uses: apecloud/apecloud-cd/.github/workflows/[email protected] | |
with: | |
IMG: "apecloud/kubeblocks-datascript" | |
VERSION: "${{ needs.image-tag.outputs.tag-name }}" | |
APECD_REF: "v0.1.12" | |
DOCKERFILE_PATH: "./docker/Dockerfile-datascript" | |
secrets: inherit | |
send-message: | |
runs-on: ubuntu-latest | |
needs: [ release-image, release-tools-image, release-datascript-image] | |
if: ${{ always() && github.event.action == 'published' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: send message | |
id: send_message | |
run: | | |
release_result="${{ env.RELEASE_VERSION }}-image" | |
touch ${release_result} | |
echo 'release-result='${release_result} >> $GITHUB_OUTPUT | |
CONTENT="release\u00a0${{ env.RELEASE_VERSION }}\u00a0image\u00a0error" | |
if [[ "${{ needs.release-image.result }}" == "success" && "${{ needs.release-tools-image.result }}" == "success" && "${{ needs.release-datascript-image.result }}" == "success" ]]; then | |
CONTENT="release\u00a0${{ env.RELEASE_VERSION }}\u00a0image\u00a0success" | |
echo "success" > ${release_result} | |
else | |
echo "error" > ${release_result} | |
fi | |
bash .github/utils/utils.sh --type 12 \ | |
--tag-name ${{ env.RELEASE_VERSION }} \ | |
--content "${CONTENT}"\ | |
--bot-webhook ${{ env.RELEASE_BOT_WEBHOOK }} \ | |
--run-url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" | |
- name: delete cache | |
continue-on-error: true | |
run: | | |
bash .github/utils/utils.sh --type 17 --tag-name "${{ steps.send_message.outputs.release-result }}" | |
- name: Save Artifact | |
id: cache-artifact-save | |
uses: actions/cache/save@v3 | |
with: | |
path: | | |
${{ steps.send_message.outputs.release-result }} | |
key: ${{ steps.send_message.outputs.release-result }} |