test no tmp file #214
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 | |
on: | |
push: | |
branches: | |
- test | |
permissions: | |
contents: write | |
packages: write | |
checks: write | |
pull-requests: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
TOOLS_PATH: "/opt/tools/bin" | |
VERSION: 1.2.0 | |
# 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/tools | |
# configure userdata for commits | |
git config --global user.email "[email protected]" | |
git config --global user.name "Everest RC CI triggered by ${{ github.actor }}" | |
if [[ $IS_RC == 1 ]]; then | |
go run . \ | |
--veneer-file ../veneer/everest-operator.yaml \ | |
--channel fast-v0 \ | |
--new-version ${{ env.VERSION }} \ | |
>| ../veneer/everest-operator.yaml | |
else | |
go run . \ | |
--veneer-file ../veneer/everest-operator.yaml \ | |
--channel stable-v0 \ | |
--new-version ${{ env.VERSION }} \ | |
>| ../veneer/everest-operator.yaml | |
go run . \ | |
--veneer-file ../veneer/everest-operator.yaml \ | |
--channel fast-v0 \ | |
--new-version ${{ env.VERSION }} \ | |
>| ../veneer/everest-operator.yaml | |
fi | |
curl -Lo /tmp/opm https://github.com/operator-framework/operator-registry/releases/download/v1.44.0/${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 test | |