Skip to content

Release Image:: v0.7.0-alpha.19 #343

Release Image:: v0.7.0-alpha.19

Release Image:: v0.7.0-alpha.19 #343

Workflow file for this run

name: Release Image
on:
workflow_dispatch:
inputs:
image_tag:
description: 'The tag of image'
required: true
default: ''
image_name:
description: 'Only release select image'
required: false
default: ''
type: choice
options:
- ""
- aperag
- aperag-frontend
release:
types:
- published
env:
RELEASE_VERSION: ${{ github.ref_name }}
run-name: Release Image:${{ inputs.image_name }}:${{ inputs.image_tag }} ${{ github.ref_name }}
jobs:
image-tag:
runs-on: ubuntu-latest
outputs:
tag-name: ${{ steps.get_tag_name.outputs.tag_name }}
artifact-key: ${{ steps.get_tag_name.outputs.artifact_key }}
steps:
- name: Get Tag Name
id: get_tag_name
run: |
TAG_NAME=${{ inputs.image_tag }}
if [[ -z "$TAG_NAME" ]]; then
TAG_NAME="${{ env.RELEASE_VERSION }}"
fi
echo tag_name=$TAG_NAME >> $GITHUB_OUTPUT
ARTIFACT_KEY="${{ env.RELEASE_VERSION }}-image"
echo 'artifact_key='${ARTIFACT_KEY} >> $GITHUB_OUTPUT
release-aperag-image:
if: ${{ github.event.action == 'published' || inputs.image_name == '' || inputs.image_name == 'aperag' }}
name: release-aperag
needs: [ image-tag ]
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
with:
IMG: "apecloud/aperag"
VERSION: "${{ needs.image-tag.outputs.tag-name }}"
DOCKERFILE_PATH: "./Dockerfile"
REMOVE_PREFIX: false
APECD_REF: "v0.1.93"
ENABLE_SUBMODULE: true
secrets: inherit
release-result:
runs-on: ubuntu-latest
needs: [ release-aperag-image ]
if: ${{ always() && (github.event.action == 'published' || contains(inputs.image_tag, 'nightly')) }}
outputs:
release-result: ${{ steps.get_release_result.outputs.release_result }}
steps:
- name: get release result
id: get_release_result
run: |
ARTIFACT_KEY="${{ env.RELEASE_VERSION }}-image"
touch ${ARTIFACT_KEY}
echo 'artifact_key='${ARTIFACT_KEY} >> $GITHUB_OUTPUT
RELEASE_RESULT="error"
if [[ "${{ needs.release-aperag-image.result }}" == "success" ]]; then
RELEASE_RESULT="success"
echo "success" > ${ARTIFACT_KEY}
else
echo "error" > ${ARTIFACT_KEY}
fi
echo 'release_result='$RELEASE_RESULT >> $GITHUB_OUTPUT
- name: Checkout apecloud-cd Code
uses: actions/checkout@v4
with:
repository: apecloud/apecloud-cd
path: apecloud-cd
ref: "v0.1.42"
- name: delete actions cache
continue-on-error: true
run: |
bash apecloud-cd/.github/utils/utils.sh --type 30 \
--github-repo "${{ github.repository }}" \
--tag-name "${{ steps.get_release_result.outputs.artifact_key }}"
- name: Save Artifact
id: cache-artifact-save
uses: actions/cache/save@v3
with:
path: |
${{ steps.get_release_result.outputs.artifact_key }}
key: ${{ steps.get_release_result.outputs.artifact_key }}
send-message:
needs: [ image-tag, release-result ]
if: ${{ always() && (github.event.action == 'published' || contains(inputs.image_tag, 'nightly')) }}
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
with:
TYPE: "2"
CONTENT: "release image ${{ needs.image-tag.outputs.tag-name }} ${{ needs.release-result.outputs.release-result }}"
APECD_REF: "v0.1.36"
secrets: inherit
check-result:
if: github.event.action == 'published'
needs: [ release-result ]
runs-on: ubuntu-latest
strategy:
matrix:
type: [image, chart]
steps:
- name: Restore ${{ matrix.type }} Artifact
id: cache-artifact-restore
uses: actions/cache/restore@v3
with:
path: |
${{ env.RELEASE_VERSION }}-${{ matrix.type }}
key: ${{ env.RELEASE_VERSION }}-${{ matrix.type }}
- name: check release result
run: |
release_result=$( cat ${{ env.RELEASE_VERSION }}-${{ matrix.type }} )
if [[ "$release_result" != "success" ]]; then
exit 1
fi
e2e-aperag:
needs: [ image-tag, release-result, check-result ]
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
with:
GITHUB_REPO: "apecloud/ApeRAG"
BRANCH_NAME: "main"
WORKFLOW_ID: "e2e-aperag.yml"
VERSION: "${{ needs.image-tag.outputs.tag-name }}"
APECD_REF: "v0.1.41"
secrets: inherit
release-aperag-frontend-image:
if: ${{ github.event.action == 'published' || inputs.image_name == '' || inputs.image_name == 'aperag-frontend' }}
name: release-aperag-frontend
needs: [ image-tag ]
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
with:
IMG: "apecloud/aperag-frontend"
VERSION: "${{ needs.image-tag.outputs.tag-name }}"
DOCKERFILE_PATH: "./web/Dockerfile"
CONTEXT: "./web"
REMOVE_PREFIX: false
APECD_REF: "v0.1.93"
ENABLE_SUBMODULE: true
MAKE_OPS_PRE: "build-aperag-frontend-assets"
secrets: inherit
release-aperag-frontend-result:
runs-on: ubuntu-latest
needs: [ release-aperag-frontend-image ]
if: ${{ always() && (github.event.action == 'published' || contains(inputs.image_tag, 'nightly')) }}
outputs:
release-result: ${{ steps.get_release_result.outputs.release_result }}
steps:
- name: get release result
id: get_release_result
run: |
RELEASE_RESULT="error"
if [[ "${{ needs.release-aperag-frontend-image.result }}" == "success" ]]; then
RELEASE_RESULT="success"
fi
echo 'release_result='$RELEASE_RESULT >> $GITHUB_OUTPUT
send-aperag-frontend-message:
needs: [ image-tag, release-aperag-frontend-result ]
if: ${{ always() && (github.event.action == 'published' || contains(inputs.image_tag, 'nightly')) }}
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
with:
TYPE: "2"
CONTENT: "release aperag-frontend image ${{ needs.image-tag.outputs.tag-name }} ${{ needs.release-aperag-frontend-result.outputs.release-result }}"
APECD_REF: "v0.1.36"
secrets: inherit