v0.4.0 #30
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
release: | |
types: | |
- published | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
create-pr-to-update-kustomization: | |
needs: [build-and-push-image] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
ref: 'main' | |
- name: Update kustomization | |
run: IMG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_REF:10} make update-version-to-install | |
- name: Set output | |
id: set-output | |
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> "$GITHUB_OUTPUT" | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
title: "chore: bump version to ${{ steps.set-output.outputs.RELEASE_VERSION }} in install/kustomization.yaml" | |
body: | | |
# Why | |
- New version [${{ steps.set-output.outputs.RELEASE_VERSION }}](${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ steps.set-output.outputs.RELEASE_VERSION }}) was released. | |
# What | |
- Update kustomization for installation | |
create-pr-for-helm-charts: | |
needs: [build-and-push-image] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
ref: main | |
repository: nakamasato/helm-charts | |
- name: Set output | |
id: set-output | |
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> "$GITHUB_OUTPUT" | |
- name: Update app version | |
run: | | |
yq e -i ".version = \"${{ steps.set-output.outputs.RELEASE_VERSION }}\"" charts/mysql-operator/Chart.yaml | |
yq e -i ".appVersion = \"${{ steps.set-output.outputs.RELEASE_VERSION }}\"" charts/mysql-operator/Chart.yaml | |
yq e -i ".controllerManager.manager.image.tag = \"${{ steps.set-output.outputs.RELEASE_VERSION }}\"" charts/mysql-operator/values.yaml | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.PAT_TO_UPDATE_HELM_CHARTS_REPO }} # when expired, need to update in https://github.com/settings/tokens | |
title: "chore: bump mysql-operator version to ${{ steps.set-output.outputs.RELEASE_VERSION }}" | |
branch: bump-mysql-operator-chart | |
body: | | |
# Why | |
- New version [${{ steps.set-output.outputs.RELEASE_VERSION }}](${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ steps.set-output.outputs.RELEASE_VERSION }}) was released. | |
# What | |
- bump mysql-operator chart version to [${{ steps.set-output.outputs.RELEASE_VERSION }}](${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ steps.set-output.outputs.RELEASE_VERSION }}) |