-
Notifications
You must be signed in to change notification settings - Fork 1
161 lines (151 loc) · 5.81 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Release version"
default: "E.g. 4.0.0"
required: true
next:
description: "Next version"
default: "E.g. 5.0.0-SNAPSHOT"
required: false
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
cache: maven
- name: Set release version ${{ github.event.inputs.version }}
run: |
mvn -B versions:set versions:commit -DnewVersion=$NEW_VERSION
env:
NEW_VERSION: ${{ github.event.inputs.version }}
- name: Commit and Push
uses: trustification/release-tools/.github/actions/commit@main
with:
commit_message: "🏁 Releasing version ${{ github.event.inputs.version }}"
branch: main
release:
needs: [ prepare ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
cache: maven
- name: JReleaser - release
uses: jreleaser/release-action@v2
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GH_PAT }}
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }}
JRELEASER_PRERELEASE_PATTERN: .*(?:Alpha|alpha|Beta|beta)[0-9]
- name: JReleaser - generate log
if: always()
shell: bash
run: tar -czvf jreleaser-log.tgz out/
- name: JReleaser - upload log
if: always()
uses: actions/upload-artifact@v3
with:
name: jreleaser-log
path: 'jreleaser-log.tgz'
- name: Set version ${{ github.event.inputs.next }}
run: |
mvn -B versions:set versions:commit -DnewVersion=$NEW_VERSION
env:
NEW_VERSION: ${{ github.event.inputs.next }}
- name: Commit and Push
uses: trustification/release-tools/.github/actions/commit@main
with:
commit_message: "⬆️ Next version ${{ github.event.inputs.next }}"
branch: main
publish-bundle:
needs: [ release ]
runs-on: ubuntu-latest
steps:
- name: wait for image
run: |
#!/bin/bash
while ! docker pull ghcr.io/${{ github.repository_owner }}/trustify-operator-bundle:v${{ github.event.inputs.version }} &> /dev/null; do
sleep 3m
done
docker image inspect ghcr.io/${{ github.repository_owner }}/trustify-operator-bundle:v${{ github.event.inputs.version }}
- name: Create scratch bundle image
run: |
docker create --name extract "ghcr.io/${{ github.repository_owner }}/trustify-operator-bundle:v${{ github.event.inputs.version }}" foo
- name: Checkout community operators
uses: actions/checkout@v4
with:
repository: k8s-operatorhub/community-operators
path: community-operators
ref: main
fetch-depth: 0
- name: Update community operators
working-directory: ./community-operators
run: |
version="${{ github.event.inputs.version }}"
co_version="${version:0}"
operator_path="./operators/trustify-operator/${co_version}"
mkdir -p "${operator_path}"
docker cp extract:/metadata "${operator_path}"
docker cp extract:/manifests "${operator_path}"
git diff
- name: Checkout redhat community operators
uses: actions/checkout@v4
with:
repository: redhat-openshift-ecosystem/community-operators-prod
path: redhat-community-operators
ref: main
fetch-depth: 0
- name: Update redhat community operators
working-directory: ./redhat-community-operators
run: |
version="${{ inputs.version }}"
co_version="${version:0}"
operator_path="./operators/trustify-operator/${co_version}"
mkdir -p "${operator_path}"
docker cp extract:/metadata "${operator_path}"
docker cp extract:/manifests "${operator_path}"
git diff
- name: Create Pull Request - Community Operators
uses: peter-evans/create-pull-request@v5
id: co-cpr
with:
token: ${{ secrets.GH_PAT }}
path: ./community-operators
commit-message: "trustify-operator-${{ github.event.inputs.version }}"
committer: "trust.git.bot <[email protected]>"
author: "trust.git.bot <[email protected]>"
signoff: true
branch: ${{ github.event.inputs.version }}
push-to-fork: trustification/community-operators
title: "trustify-operator-${{ github.event.inputs.version }}"
# body-path: ./changelog.md
- name: Create Pull Request - Red Hat Community Operators
uses: peter-evans/create-pull-request@v5
id: rhco-cpr
with:
token: ${{ secrets.GH_PAT }}
path: ./redhat-community-operators
commit-message: "trustify-operator-${{ github.event.inputs.version }}"
committer: "trust.git.bot <[email protected]>"
author: "trust.git.bot <[email protected]>"
signoff: true
branch: ${{ github.event.inputs.version }}
push-to-fork: trustification/community-operators-prod
title: "trustify-operator-${{ github.event.inputs.version }}"
# body-path: ./changelog.md
- name: PR Notifications
run: |
echo "::notice:: Community Operators Pull Request URL - ${{ steps.co-cpr.outputs.pull-request-url }}"
echo "::notice:: Red Hat Community Operators Pull Request URL - ${{ steps.rhco-cpr.outputs.pull-request-url }}"