-
Notifications
You must be signed in to change notification settings - Fork 5
66 lines (61 loc) · 2.3 KB
/
index-render-template-main.yaml
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
name: index-render-template-main
on:
workflow_dispatch: {}
pull_request:
paths:
- .konflux/olm-catalog/index/**
push:
paths:
paths:
- .konflux/olm-catalog/index/**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-matrix:
runs-on: ubuntu-latest
if: github.repository_owner == 'openshift-pipelines' # do not run this elsewhere
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- id: set-matrix
run: |
echo "versions=$(cd .konflux/olm-catalog/index && ls -d v*)" >> $GITHUB_OUTPUT
outputs:
versions: ${{ steps.set-matrix.outputs.projects }}
generate-catalog:
needs: build-matrix
if: github.repository_owner == 'openshift-pipelines' # do not run this elsewhere
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.build-matrix.outputs.version) }}
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Generate ${{matrix.version}} catalog
run: |
echo ${{matrix.version}}
curl -sSfLo /usr/local/bin/opm "https://github.com/operator-framework/operator-registry/releases/download/v1.47.0/linux-amd64-opm"
chmod +x /usr/local/bin/opm
opm alpha render-template basic .konflux/olm-catalog/index/${{matrix.version}}/catalog-template.json > .konflux/olm-catalog/index/${{matrix.version}}/catalog/openshift-pipelines-operator-rh/catalog.json
- name: Commit new changes
run: |
git config user.name openshift-pipelines-bot
git config user.email [email protected]
git checkout -b actions/index/${{matrix.version}}
git add .konflux/olm-catalog/index/${{matrix.version}}/catalog
git commit -F- <<EOF
[bot:main] Update ${{matrix.version}} generate catalog
EOF
git push -f origin actions/index/${{matrix.version}}
if [ "$(gh pr list --base main --head actions/index/${{matrix.version}} --json url --jq 'length')" = "0" ]; then
echo "creating PR..."
gh pr create -B main -H actions/index/${{matrix.version}} --label=automated --fill
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}