Skip to content

v0.32.1

v0.32.1 #58

Workflow file for this run

on:
release:
types: [published]
name: Publish Bundle
jobs:
build:
name: Publish Bundle
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Get Release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }}
- name: Generate Bundle
run: |
git submodule init
git submodule update
podman build -t common-templates-ci ./builder/
podman run \
-v "$(pwd)":/common-templates \
common-templates-ci \
/bin/bash -c "cd /common-templates && export REVISION=1 VERSION="${{ steps.get_release.outputs.tag_name }}" && make release"
- name: Upload Release Bundles
id: upload-bundle-asset
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
fail_on_unmatched_files: true
files: |
./dist/common-templates-${{ steps.get_release.outputs.tag_name }}.yaml
./dist/common-templates-amd64-${{ steps.get_release.outputs.tag_name }}.yaml
./dist/common-templates-s390x-${{ steps.get_release.outputs.tag_name }}.yaml
- name: Install golang
uses: actions/setup-go@v2
- name: Update SSP Operator
run: |
# Define vars
export VERSION="${{ steps.get_release.outputs.tag_name }}"
export TEMPLATES_FILE=common-templates-${VERSION}.yaml
export AMD64_TEMPLATES_FILE=common-templates-amd64-${VERSION}.yaml
export S390X_TEMPLATES_FILE=common-templates-s390x-${VERSION}.yaml
# If GITHUB_FORK_USER is changed, a new access token should be set as a repo secret (ACTIONS_TOKEN)
export GITHUB_FORK_USER=ksimon1
# Set git configs to sign the commit
git config --global user.email "[email protected]"
git config --global user.name "Common-templates Release Automation"
# Clone the operator repo with a token to allow pushing before creating a PR
git clone https://${GITHUB_FORK_USER}:${{ secrets.ACTIONS_TOKEN }}@github.com/${GITHUB_FORK_USER}/ssp-operator
# Authenticate with gh cli
echo ${{ secrets.ACTIONS_TOKEN }} > token.txt
gh auth login --with-token < token.txt
rm token.txt
cd ssp-operator
git remote add upstream https://github.com/kubevirt/ssp-operator
git fetch upstream
git checkout main
git rebase upstream/main
git checkout -b update-common-templates-${VERSION}
# Update the new common-templates file
cp ../dist/${TEMPLATES_FILE} data/common-templates-bundle/${TEMPLATES_FILE}
cp ../dist/${AMD64_TEMPLATES_FILE} data/common-templates-bundle/${AMD64_TEMPLATES_FILE}
cp ../dist/${S390X_TEMPLATES_FILE} data/common-templates-bundle/${S390X_TEMPLATES_FILE}
sed -i "s/\bVersion\s*=.*/Version = \"${VERSION}\"/g" internal/operands/common-templates/version.go
go fmt ./...
# Commit and push the changes to the update branch
git add data internal
git commit -sm "Update common-templates bundle to version ${VERSION}"
git push --set-upstream origin update-common-templates-${VERSION}
# Create a new PR in the operator repo
gh pr create --repo kubevirt/ssp-operator \
--base main \
--head ${GITHUB_FORK_USER}:update-common-templates-${VERSION} \
--title "Update common-templates to ${VERSION}" \
--body "$(cat << EOF
Update common-templates bundle to ${VERSION}
**Release note**:
\`\`\`release-note
Update common-templates bundle to ${VERSION}
\`\`\`
EOF
)
"