Release Action: upload operator image #119
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 Operator | |
on: | |
workflow_dispatch: | |
inputs: | |
action: | |
description: 'What release actions to run?' | |
required: true | |
type: choice | |
options: | |
- all | |
- upload operator image | |
- create github release | |
- add helm chart | |
- upload bundle for operatorhub OLM catalog | |
- upload bundle for openshift OLM catalog | |
olm_catalog_fork_owner: | |
description: 'GitHub ID of the owner for the OLM catalog forks' | |
required: false | |
type: string | |
secrets: | |
DOCKERHUB_USERNAME: | |
description: 'When working with images from docker.io, this is the username for login purposes' | |
required: true | |
DOCKERHUB_TOKEN: | |
description: 'When working with images from docker.io, this is the password for login purposes' | |
required: true | |
PAT_TOKEN: | |
description: Personal access token to GitHub. Access to repos other than this one. | |
required: true | |
run-name: "Release Action: ${{ inputs.action }}" | |
jobs: | |
create-release: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: vertica-kubernetes | |
fetch-depth: 0 | |
- name: Save current version to env VERSION | |
shell: bash | |
run: | | |
cd vertica-kubernetes | |
echo $(make echo-versions | grep -e '^VERSION=' ) >> $GITHUB_ENV | |
- name: Save current sha to env VERSION_SHA | |
shell: bash | |
run: | | |
cd vertica-kubernetes | |
git tag --list | |
echo "VERSION_SHA=$(git rev-list -n 1 v$VERSION)" >> $GITHUB_ENV | |
- name: Download the release artifacts | |
run: | | |
cd vertica-kubernetes | |
scripts/download-release-artifacts.sh -d ci-artifacts $VERSION | |
find ci-artifacts | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Login to Docker Hub | |
if: ${{ inputs.action == 'upload operator image' || inputs.action == 'all' }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Upload new image | |
if: ${{ inputs.action == 'upload operator image' || inputs.action == 'all' }} | |
run: | | |
docker buildx imagetools create --tag opentext/verticadb-operator:$VERSION ghcr.io/vertica/verticadb-operator:$VERSION_SHA | |
- name: Create the release on GitHub | |
if: ${{ inputs.action == 'create github release' || inputs.action == 'all' }} | |
run: | | |
cd vertica-kubernetes | |
scripts/create-release.sh -d ci-artifacts $VERSION | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Start workflow to add the helm chart for the operator release | |
if: ${{ inputs.action == 'add helm chart' || inputs.action == 'all' }} | |
run: | | |
curl \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: token ${{ secrets.PAT_TOKEN }}" \ | |
--fail \ | |
https://api.github.com/repos/vertica/charts/actions/workflows/add-verticadb-chart.yaml/dispatches \ | |
-d '{"ref":"main", | |
"inputs":{"operator_version":"'"$VERSION"'"}}' | |
- name: Upload the OPM bundle to fork of k8s-operatorhub/community-operators | |
if: ${{ inputs.action == 'upload bundle for operatorhub OLM catalog' || inputs.action == 'all' }} | |
uses: ./vertica-kubernetes/.github/actions/upload-opm-bundle | |
with: | |
token: ${{ secrets.PAT_TOKEN }} | |
version: ${{ env.VERSION }} | |
upstreamRepo: k8s-operatorhub/community-operators | |
forkRepo: ${{ inputs.olm_catalog_fork_owner }}/community-operators | |
localRepoPath: community-operators | |
bundlePath: vertica-kubernetes/ci-artifacts/${{ env.VERSION }}/olm-bundle | |
- name: Upload the OPM bundle to fork of redhat-openshift-ecosystem/community-operators-prod | |
if: ${{ inputs.action == 'upload bundle for openshift OLM catalog' || inputs.action == 'all' }} | |
uses: ./vertica-kubernetes/.github/actions/upload-opm-bundle | |
with: | |
token: ${{ secrets.PAT_TOKEN }} | |
version: ${{ env.VERSION }} | |
upstreamRepo: redhat-openshift-ecosystem/community-operators-prod | |
forkRepo: ${{ inputs.olm_catalog_fork_owner }}/community-operators-prod | |
localRepoPath: community-operators-prod | |
bundlePath: vertica-kubernetes/ci-artifacts/${{ env.VERSION }}/olm-bundle |