Skip to content

fix: add workflow for client #13

fix: add workflow for client

fix: add workflow for client #13

Workflow file for this run

#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: "Run prepare for client release"
on:
workflow_dispatch:
inputs:
release_version:
description: "Released Vald version"
type: string
pull_request:
# schedule:
# - cron: "*/10 * * * *"
jobs:
semver-auto:
runs-on: ubuntu-latest
outputs:
SUPPORTED_LATEST_VALD_VERSION: ${{ steps.set_vald_context.outputs.SUPPORTED_LATEST_VALD_VERSION }}
SUPPORTED_LAST_VALD_VERSION: ${{ steps.set_vald_context.outputs.SUPPORTED_LAST_VALD_VERSION }}
UPGRADE_SUPPORTED_LATEST_CLIENT_VERSION: ${{ steps.check_upgrade.outputs.UPGRADE_SUPPORTED_LATEST_CLIENT_VERSION }}
UPGRADE_SUPPORTED_LAST_CLIENT_VERSION: ${{ steps.check_upgrade.outputs.UPGRADE_SUPPORTED_LAST_CLIENT_VERSION }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.DISPATCH_TOKEN }}
- name: Set Git config
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Clone Vald repository
run: |
git clone https://github.com/vdaas/vald.git
- name: Set Vald context
id: set_vald_context
working-directory: vald
run: |
VALD_TAG_LIST=$(git tag --sort=-v:refname)
SUPPORTED_TWO_VALD_VERSIONS=$(echo "${VALD_TAG_LIST}" | awk -F. '{print $1"."$2}' | uniq | head -n 2)
SUPPORTED_LATEST_VALD_VERSION=$(echo "${VALD_TAG_LIST}" | grep $(echo "${SUPPORTED_TWO_VALD_VERSIONS}" | head -n 1) | head -n 1)
SUPPORTED_LAST_VALD_VERSION=$(echo "${VALD_TAG_LIST}" | grep $(echo "${SUPPORTED_TWO_VALD_VERSIONS}" | tail -n 1) | head -n 1)
SUPPORTED_TWO_VALD_VERSIONS=$(echo ${SUPPORTED_TWO_VALD_VERSIONS} | tr '\n' ' ') # override to set GITHUB_OUTPUT.
echo "SUPPORTED_TWO_VALD_VERSIONS=${SUPPORTED_TWO_VALD_VERSIONS}" >> $GITHUB_OUTPUT # e.g) v1.8 v1.7
echo "SUPPORTED_LATEST_VALD_VERSION=${SUPPORTED_LATEST_VALD_VERSION}" >> $GITHUB_OUTPUT # e.g) v1.8.9
echo "SUPPORTED_LAST_VALD_VERSION=${SUPPORTED_LAST_VALD_VERSION}" >> $GITHUB_OUTPUT # e.g) v1.7.12
echo "SUPPORTED_TWO_VALD_VERSIONS=${SUPPORTED_TWO_VALD_VERSIONS}"
echo "SUPPORTED_LATEST_VALD_VERSION=${SUPPORTED_LATEST_VALD_VERSION}"
echo "SUPPORTED_LAST_VALD_VERSION=${SUPPORTED_LAST_VALD_VERSION}"
- name: Set Client context
id: set_client_context
run: |
CLIENT_TAG_LIST=$(git tag --sort=-v:refname)
SUPPORTED_TWO_CLIENT_VERSIONS=$(echo "${CLIENT_TAG_LIST}" | awk -F. '{print $1"."$2}' | uniq | head -n 2)
SUPPORTED_LATEST_CLIENT_VERSION=$(echo "${CLIENT_TAG_LIST}" | grep $(echo "${SUPPORTED_TWO_CLIENT_VERSIONS}" | head -n 1) | head -n 1)
SUPPORTED_LAST_CLIENT_VERSION=$(echo "${CLIENT_TAG_LIST}" | grep $(echo "${SUPPORTED_TWO_CLIENT_VERSIONS}" | tail -n 1) | head -n 1)
echo "SUPPORTED_LATEST_CLIENT_VERSION=${SUPPORTED_LATEST_CLIENT_VERSION}" >> $GITHUB_OUTPUT # e.g) v1.7.12
echo "SUPPORTED_LAST_CLIENT_VERSION=${SUPPORTED_LAST_CLIENT_VERSION}" >> $GITHUB_OUTPUT # e.g) v1.6.9
echo "SUPPORTED_TWO_CLIENT_VERSIONS=${SUPPORTED_TWO_CLIENT_VERSIONS}"
echo "SUPPORTED_LATEST_CLIENT_VERSION=${SUPPORTED_LATEST_CLIENT_VERSION}"
echo "SUPPORTED_LAST_CLIENT_VERSION=${SUPPORTED_LAST_CLIENT_VERSION}"
- name: Check upgrade
id: check_upgrade
run: |
if [ "${SUPPORTED_LAST_VALD_VERSION}" != "${SUPPORTED_LAST_CLIENT_VERSION}" ]; then
RELEASE_BRANCH_NAME=$(cat ${SUPPORTED_TWO_VALD_VERSIONS} | awk '{print $2}')
echo "UPGRADE_SUPPORTED_LAST_CLIENT_VERSION=true" >> $GITHUB_OUTPUT
echo "RELEASE_BRANCH_NAME=${RELEASE_BRANCH_NAME}" >> $GITHUB_OUTPUT
echo "Upgrade supported last client version"
exit 0
fi
if [ "${SUPPORTED_LATEST_VALD_VERSION}" != "${SUPPORTED_LATEST_CLIENT_VERSION}" ]; then
RELEASE_BRANCH_NAME=$(cat ${SUPPORTED_TWO_VALD_VERSIONS} | awk '{print $1}')
echo "UPGRADE_SUPPORTED_LATEST_CLIENT_VERSION=true" >> $GITHUB_OUTPUT
echo "RELEASE_BRANCH_NAME=${RELEASE_BRANCH_NAME}" >> $GITHUB_OUTPUT
echo "Upgrade supported latest client latest"
exit 0
fi
env:
SUPPORTED_TWO_VALD_VERSIONS: ${{ steps.set_vald_context.outputs.SUPPORTED_TWO_VALD_VERSIONS }}
SUPPORTED_LATEST_VALD_VERSION: ${{ steps.set_vald_context.outputs.SUPPORTED_LATEST_VALD_VERSION }}
SUPPORTED_LAST_VALD_VERSION: ${{ steps.set_vald_context.outputs.SUPPORTED_LAST_VALD_VERSION }}
SUPPORTED_LATEST_CLIENT_VERSION: ${{ steps.set_client_context.outputs.SUPPORTED_LATEST_CLIENT_VERSION }}
SUPPORTED_LAST_CLIENT_VERSION: ${{ steps.set_client_context.outputs.SUPPORTED_LAST_CLIENT_VERSION }}
# NOTE: For debug
- name: Prepare to upgrade supported last client version
if: ${{ steps.check_upgrade.outputs.UPGRADE_SUPPORTED_LAST_CLIENT_VERSION != '' && env.RELEASE_BRANCH_NAME != '' }}
run: |
echo aaaaaaaa
env:
RELEASE_BRANCH_NAME: ${{ steps.check_upgrade.outputs.RELEASE_BRANCH_NAME }}
- name: Prepare to upgrade supported last client version
if: ${{ steps.check_upgrade.outputs.UPGRADE_SUPPORTED_LATEST_CLIENT_VERSION != '' && env.RELEASE_BRANCH_NAME != '' }}
run: |
echo bbbbbbbb
env:
RELEASE_BRANCH_NAME: ${{ steps.check_upgrade.outputs.RELEASE_BRANCH_NAME }}