Skip to content

test release ci

test release ci #180

Workflow file for this run

---
name: Release
on:
push:
branches:
- test-release-ci
permissions:
contents: write
packages: write
checks: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
env:
TOOLS_PATH: "/opt/tools/bin"
#VERSION: ${{ github.event.inputs.version }}
VERSION: 0.11.0
#RELEASE_TYPE: ${{ github.event.inputs.releaseType }}
RELEASE_TYPE: minor
# version in format "X.Y" which is going to be updated with each patch release
FLOATING_TAG: ''
# branch name in format "release-X.Y"
BRANCH_NAME: ''
# GitHub tag name to use for the RC/Release
GH_TAG: ''
# Shows if this workflow is triggered for RC or Release
IS_RC: 0
ARCH: ''
OS: ''
steps:
- name: Validate input
run: |
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc[1-9][0-9]*)?$ ]]; then
echo "Wrong version format provided, please use "X.Y.Z-rcN" format for an RC or "X.Y.Z" format for a release"
exit 1
fi
- name: Set environment variables
run: |
floating_tag=${VERSION%.*}
echo "FLOATING_TAG=$floating_tag" >> $GITHUB_ENV
echo "BRANCH_NAME=release-$floating_tag" >> $GITHUB_ENV
echo "GH_TAG=v$VERSION" >> $GITHUB_ENV
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "IS_RC=1" >> $GITHUB_ENV
fi
echo "ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')" >> $GITHUB_ENV
echo "OS=$(uname | awk '{print tolower($0)}')" >> $GITHUB_ENV
- name: Catalog - checkout
uses: actions/checkout@v4
with:
repository: percona/everest-catalog
path: everest-catalog
token: ${{ secrets.ROBOT_TOKEN }}
- name: Catalog - create release branch
run: |
cd everest-catalog
# Check if the branch already exists
git fetch
check_branch=$(git ls-remote --heads origin ${BRANCH_NAME})
if [[ -z ${check_branch} ]]; then
git checkout -b $BRANCH_NAME
git push origin $BRANCH_NAME
fi
git checkout $BRANCH_NAME
# if the tag doesn't exist yet, create it
if git tag --list | grep -q "^$GH_TAG$"; then
echo "The tag is already present in github. Please create a different RC/Release"
exit 1
fi
- name: Catalog - update veneer file
run: |
cd everest-catalog
# configure userdata for commits
git config --global user.email "[email protected]"
git config --global user.name "Everest RC CI triggered by ${{ github.actor }}"
CURRENT_STABLE_VERSION=$(yq 'select(.name == "stable-v0").entries[-1].name' veneer/everest-operator.yaml | sed 's/^everest-operator.v//')
CURRENT_FAST_VERSION=$(yq 'select(.name == "fast-v0").entries[-2].name' veneer/everest-operator.yaml | sed 's/^everest-operator.v//')
if [[ -z "$CURRENT_STABLE_VERSION" ]]; then
echo "CURRENT_STABLE_VERSION is required"
exit 1
fi
if [[ -z "$CURRENT_FAST_VERSION" ]]; then
echo "CURRENT_FAST_VERSION is required"
exit 1
fi
echo "CURRENT_STABLE_VERSION=$CURRENT_STABLE_VERSION"
echo "CURRENT_FAST_VERSION=$CURRENT_FAST_VERSION"
cp veneer/everest-operator.yaml veneer/everest-operator-original.yaml
if [[ $env.IS_RC ]]; then
go run ./tools/ \
--veneer-file veneer/everest-operator-original.yaml \
--version-type ${{ env.RELEASE_TYPE }} \
--channel fast-v0 \
--new-version ${{ env.VERSION }} \
--current-version "$CURRENT_FAST_VERSION" \
\
>| veneer/everest-operator.yaml
else
go run ./tools/ \
--veneer-file veneer/everest-operator-original.yaml \
--version-type ${{ env.RELEASE_TYPE }} \
--channel stable-v0 \
--new-version ${{ env.VERSION }} \
--current-version "$CURRENT_STABLE_VERSION" \
\
>| veneer/everest-operator.yaml
echo "---- 1"
echo cat veneer/everest-operator.yaml
go run ./tools/ \
--veneer-file veneer/everest-operator-original.yaml \
--version-type ${{ env.RELEASE_TYPE }} \
--channel fast-v0 \
--new-version ${{ env.VERSION }} \
--current-version "$CURRENT_FAST_VERSION" \
\
>| veneer/everest-operator.yaml
echo "---- 2"
echo cat veneer/everest-operator.yaml
fi
rm -f veneer/everest-operator-original.yaml
curl -Lo /tmp/opm https://github.com/operator-framework/operator-registry/releases/latest/download/${OS}-${ARCH}-opm
chmod +x /tmp/opm
/tmp/opm alpha render-template basic -o yaml < veneer/everest-operator.yaml > catalog/everest-operator/catalog.yaml
# Check if veneer has the new version listed
if ! grep -q "$VERSION$" catalog/everest-operator/catalog.yaml; then
echo "catalog/everest-operator/catalog.yaml does not include the version $VERSION"
exit 1
fi
git commit -am "CI: add version ${{ env.VERSION }}"
git push origin $BRANCH_NAME