Skip to content

Commit

Permalink
ci: publish release and relative resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
runkecheng committed Mar 21, 2022
1 parent e6d9cb0 commit 37d35d9
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 13 deletions.
33 changes: 33 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: 'Features'
labels:
- 'feature'
- 'enhancement'
- title: 'Improvements'
labels:
- improvement
- documenttation
- Q&A
- Troubleshoot
- title: 'Bug Fixes'
labels:
- 'bug'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch
template: |
## Changes
$CHANGES
2 changes: 1 addition & 1 deletion .github/workflows/build_operator_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
tags: radondb/mysql-operator:${{ inputs.image_tag }}
tags: runkecheng/mysql-operator:${{ inputs.image_tag }}
2 changes: 1 addition & 1 deletion .github/workflows/build_sidecar_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
with:
push: true
file: Dockerfile.sidecar
tags: radondb/mysql-sidecar:${{ inputs.image_tag }}
tags: runkecheng/mysql-sidecar:${{ inputs.image_tag }}
22 changes: 20 additions & 2 deletions .github/workflows/publish_charts.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Publish Charts

on:
workflow_dispatch:
workflow_call:
inputs:
version:
required: true
type: string

jobs:
build:
Expand All @@ -17,6 +21,20 @@ jobs:
with:
version: v3.6.3

- name: Modify chart version
run: |
input=${{ inputs.version }}
chart_version=${input#*v}
sed -i "/^version:*/cversion: $chart_version" ./charts/mysql-operator/Chart.yaml
- name: Modify appVersion
run: |
sed -i '/^appVersion:*/cappVersion: ${{ inputs.version }}' ./charts/mysql-operator/Chart.yaml
- name: Modify operator image tag
run: |
sed -i '/^ tag:*/c\ tag: ${{ inputs.version }}' charts/mysql-operator/values.yaml
- name: Packaging the chart
run: helm package ./charts/mysql-operator/

Expand Down Expand Up @@ -46,7 +64,7 @@ jobs:

- name: Update charts index
run: |
helm repo index --url https://radondb.github.io/radondb-mysql-kubernetes/ --merge index.yaml .
helm repo index --url https://runkecheng.github.io/radondb-mysql-kubernetes/ --merge index.yaml .
git add .
- name: Check diffs
Expand Down
46 changes: 38 additions & 8 deletions .github/workflows/publish_images.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,65 @@
name: Publish images

on:
workflow_call:
inputs:
tag:
required: true
type: string
secrets:
DOCKERHUB_USERNAME:
description: 'username of dockerhub'
required: true
DOCKERHUB_TOKEN:
description: 'password of dockerhub'
required: true

workflow_dispatch:
inputs:
tag:
description: 'images tag'
required: true
type: string
build-operator:
build_operator:
description: ""
required: true
default: true
type: boolean
build-sidecar:
build_sidecar:
description: ""
required: true
default: true
type: boolean

jobs:
build-operator:
uses: radondb/radondb-mysql-kubernetes/.github/workflows/build_operator_image.yml@main
if: ${{ github.event.inputs.build-operator }}
state_event_type:
runs-on: ubuntu-latest
steps:
- name: if_workflow_call
if: github.event.workflow_call
run: |
build_operator=true
build_sidecar=true
- name: if_workflow_dispatch
if: github.event.workflow_dispatch
run: |
build_operator=${{ github.event.inputs.build_operator }}
build_sidecar=${{ github.event.inputs.build_sidecar }}
build_operator:
uses: runkecheng/radondb-mysql-kubernetes/.github/workflows/build_operator_image.yml@main
needs: state_event_type
if: build_operator
with:
image_tag: ${{ github.event.inputs.tag }}
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
build-sidecar:
uses: radondb/radondb-mysql-kubernetes/.github/workflows/build_sidecar_image.yml@main
if: ${{ github.event.inputs.build-sidecar }}

build_sidecar:
uses: runkecheng/radondb-mysql-kubernetes/.github/workflows/build_sidecar_image.yml@main
needs: state_event_type
if: build_sidecar
with:
image_tag: ${{ github.event.inputs.tag }}
secrets:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish release

on:
push:
branches: [ main ]
tags:
- major
- minor
- patch
workflow_dispatch:

jobs:
update_release_draft:
uses: runkecheng/radondb-mysql-kubernetes/.github/workflows/release_drafter.yml@main
secrets:
git_token: ${{ secrets.GITHUB_TOKEN }}

build_operator:
uses: runkecheng/radondb-mysql-kubernetes/.github/workflows/build_operator_image.yml@main
needs: update_release_draft
with:
image_tag: ${{ needs.update_release_draft.outputs.version }}
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

build_sidecar:
uses: runkecheng/radondb-mysql-kubernetes/.github/workflows/build_sidecar_image.yml@main
needs: update_release_draft
with:
image_tag: ${{ needs.update_release_draft.outputs.version }}
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

publish_chart:
uses: runkecheng/radondb-mysql-kubernetes/.github/workflows/publish_charts.yml@main
needs: update_release_draft
with:
version: ${{ needs.update_release_draft.outputs.version }}

23 changes: 23 additions & 0 deletions .github/workflows/release_drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

name: Draft release

on:
workflow_call:
secrets:
git_token:
description: 'token of guthub'
required: true
outputs:
version:
description: "The release version"
value: ${{ jobs.update_release_draft.outputs.version }}
jobs:
update_release_draft:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.draft.outputs.tag_name }}
steps:
- uses: release-drafter/release-drafter@v5
id: draft
env:
GITHUB_TOKEN: ${{ secrets.git_token }}
2 changes: 1 addition & 1 deletion charts/mysql-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 2.1.3
version: v2.1.3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down

0 comments on commit 37d35d9

Please sign in to comment.