This repository was archived by the owner on Jan 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
75 lines (68 loc) · 2.46 KB
/
bundle-push.yaml
File metadata and controls
75 lines (68 loc) · 2.46 KB
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
name: Build and Push Images
on:
push:
tags:
- '**'
paths-ignore:
- README.md
- .gitignore
- .github/**
workflow_dispatch:
workflow_call:
inputs:
tag:
required: false
type: string
jobs:
bundle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set Version
run: |
TAG=${{ inputs.tag }}
if [[ $GITHUB_REF_TYPE == "tag" ]]; then
TAG=${GITHUB_REF#refs/*/}
echo "VERSION=$TAG" >> $GITHUB_ENV
elif [[ ! -z $TAG ]]; then
echo "VERSION=$TAG" >> $GITHUB_ENV
else
VERSION=$(git tag -l -n1 --format="%(refname:strip=2)" | sort -V | tail -n1)
VERSION=$(awk -F. '/[0-9]+\./{$NF++;print}' OFS=. <<< "$VERSION")
TAG=experimental
echo "version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
fi
echo "IMG=ghcr.io/${GITHUB_REPOSITORY,,}:$TAG" >> $GITHUB_ENV
echo "BUNDLE_IMG=ghcr.io/${GITHUB_REPOSITORY,,}-bundle:$TAG" >> $GITHUB_ENV
echo "CATALOG_IMG=ghcr.io/${GITHUB_REPOSITORY,,}-catalog:$TAG" >> $GITHUB_ENV
echo "IMAGE_TAG_BASE=ghcr.io/${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
- name: Install operator-sdk
run: |
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
export OS=$(uname | awk '{print tolower($0)}')
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v1.26.0
curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
chmod +x operator-sdk_${OS}_${ARCH} && sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Images
shell: bash
run: |
cd github-arc-operator/
make docker-build docker-push
make bundle bundle-build bundle-push catalog-build catalog-push
- name: Create Release Branch
run: |
git config --global user.email "Michael.McMullen@ibm.com"
git config --global user.name "Github Action"
git checkout -b release-${VERSION}
git add .
git commit -am "$VERSION bundle created"
git push -u origin release-${VERSION}