-
Notifications
You must be signed in to change notification settings - Fork 25
117 lines (104 loc) · 4.28 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
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