Skip to content

Commit d2d99c6

Browse files
authored
Merge pull request #422 from runkecheng/main
workflow: Publish release only one click. #421
2 parents f2d534c + 3ea143e commit d2d99c6

File tree

10 files changed

+180
-28
lines changed

10 files changed

+180
-28
lines changed

.github/release-drafter.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name-template: 'v$RESOLVED_VERSION'
2+
tag-template: 'v$RESOLVED_VERSION'
3+
categories:
4+
- title: 'Features'
5+
labels:
6+
- 'feature'
7+
- 'enhancement'
8+
- title: 'Improvements'
9+
labels:
10+
- improvement
11+
- documentation
12+
- Q&A
13+
- Troubleshoot
14+
- title: 'Bug Fixes'
15+
labels:
16+
- 'bug'
17+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
18+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
19+
version-resolver:
20+
major:
21+
labels:
22+
- 'major'
23+
minor:
24+
labels:
25+
- 'minor'
26+
patch:
27+
labels:
28+
- 'patch'
29+
default: patch
30+
template: |
31+
## Changes
32+
33+
$CHANGES

.github/workflows/auto_build_operator.yml renamed to .github/workflows/build_operator_image.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
name: auto build operator
1+
name: Build operator
22

33
on:
4-
push:
5-
branches: [ main ]
6-
paths:
7-
- cmd/manager/*
8-
- api/*
9-
- mysqlcluster/**
10-
- controllers/*
11-
- internal/*
12-
- utils/*
13-
- backup/*
14-
- mysqluser/*
15-
workflow_dispatch:
4+
workflow_call:
5+
inputs:
6+
image_tag:
7+
required: true
8+
type: string
9+
secrets:
10+
DOCKERHUB_USERNAME:
11+
description: 'username of dockerhub'
12+
required: true
13+
DOCKERHUB_TOKEN:
14+
description: 'password of dockerhub'
15+
required: true
1616

1717
jobs:
1818
build:
@@ -35,4 +35,4 @@ jobs:
3535
uses: docker/build-push-action@v2
3636
with:
3737
push: true
38-
tags: radondb/mysql-operator:latest
38+
tags: radondb/mysql-operator:${{ inputs.image_tag }}
Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
name: auto build sidecar
1+
name: Build sidecar
22

33
on:
4-
push:
5-
branches: [ main ]
6-
paths:
7-
- cmd/sidecar/*
8-
- sidecar/*
9-
- utils/*
10-
workflow_dispatch:
4+
workflow_call:
5+
inputs:
6+
image_tag:
7+
required: true
8+
type: string
9+
secrets:
10+
DOCKERHUB_USERNAME:
11+
description: 'username of dockerhub'
12+
required: true
13+
DOCKERHUB_TOKEN:
14+
description: 'password of dockerhub'
15+
required: true
1116

1217
jobs:
1318
build:
@@ -31,4 +36,4 @@ jobs:
3136
with:
3237
push: true
3338
file: Dockerfile.sidecar
34-
tags: radondb/mysql-sidecar:latest
39+
tags: radondb/mysql-sidecar:${{ inputs.image_tag }}

.github/workflows/code_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: code check
1+
name: Code check
22

33
on:
44
push:

.github/workflows/greetings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: greetings
1+
name: Greetings
22

33
on: issues
44

.github/workflows/publish_charts.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
name: Publish Charts
22

33
on:
4-
workflow_dispatch:
4+
workflow_call:
5+
inputs:
6+
version:
7+
required: true
8+
type: string
59

610
jobs:
711
build:
@@ -17,6 +21,20 @@ jobs:
1721
with:
1822
version: v3.6.3
1923

24+
- name: Modify chart version
25+
run: |
26+
input=${{ inputs.version }}
27+
chart_version=${input#*v}
28+
sed -i "/^version:*/cversion: $chart_version" ./charts/mysql-operator/Chart.yaml
29+
30+
- name: Modify appVersion
31+
run: |
32+
sed -i '/^appVersion:*/cappVersion: ${{ inputs.version }}' ./charts/mysql-operator/Chart.yaml
33+
34+
- name: Modify operator image tag
35+
run: |
36+
sed -i '/^ tag:*/c\ tag: ${{ inputs.version }}' charts/mysql-operator/values.yaml
37+
2038
- name: Packaging the chart
2139
run: helm package ./charts/mysql-operator/
2240

@@ -31,7 +49,7 @@ jobs:
3149
runs-on: ubuntu-20.04
3250
needs: build
3351
steps:
34-
- uses: actions/checkout@v2
52+
- uses: actions/checkout@v3
3553
with:
3654
ref: operator-charts
3755

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish images
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'images tag'
8+
required: true
9+
type: string
10+
build_operator:
11+
description: ""
12+
required: true
13+
default: true
14+
type: boolean
15+
build_sidecar:
16+
description: ""
17+
required: true
18+
default: true
19+
type: boolean
20+
21+
jobs:
22+
build_operator:
23+
uses: radondb/radondb-mysql-kubernetes/.github/workflows/build_operator_image.yml@main
24+
if: ${{ github.event.inputs.build_operator }}
25+
with:
26+
image_tag: ${{ github.event.inputs.tag }}
27+
secrets:
28+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
29+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
30+
31+
build_sidecar:
32+
uses: radondb/radondb-mysql-kubernetes/.github/workflows/build_sidecar_image.yml@main
33+
if: ${{ github.event.inputs.build_sidecar }}
34+
with:
35+
image_tag: ${{ github.event.inputs.tag }}
36+
secrets:
37+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
38+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
update_release_draft:
8+
uses: radondb/radondb-mysql-kubernetes/.github/workflows/release_drafter.yml@main
9+
secrets:
10+
git_token: ${{ secrets.GITHUB_TOKEN }}
11+
12+
build_operator:
13+
uses: radondb/radondb-mysql-kubernetes/.github/workflows/build_operator_image.yml@main
14+
needs: update_release_draft
15+
with:
16+
image_tag: ${{ needs.update_release_draft.outputs.version }}
17+
secrets:
18+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
19+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
20+
21+
build_sidecar:
22+
uses: radondb/radondb-mysql-kubernetes/.github/workflows/build_sidecar_image.yml@main
23+
needs: update_release_draft
24+
with:
25+
image_tag: ${{ needs.update_release_draft.outputs.version }}
26+
secrets:
27+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
28+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
29+
30+
publish_chart:
31+
uses: radondb/radondb-mysql-kubernetes/.github/workflows/publish_charts.yml@main
32+
needs: update_release_draft
33+
with:
34+
version: ${{ needs.update_release_draft.outputs.version }}
35+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
name: Draft release
3+
4+
on:
5+
workflow_call:
6+
secrets:
7+
git_token:
8+
description: 'token of github'
9+
required: true
10+
outputs:
11+
version:
12+
description: "The release version"
13+
value: ${{ jobs.update_release_draft.outputs.version }}
14+
jobs:
15+
update_release_draft:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
version: ${{ steps.draft.outputs.tag_name }}
19+
steps:
20+
- uses: release-drafter/release-drafter@v5
21+
id: draft
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.git_token }}

.github/workflows/unit_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: unit tests
1+
name: Unit tests
22

33
on:
44
push:

0 commit comments

Comments
 (0)