Updated release workflow

This commit is contained in:
mmontes11
2024-07-17 19:59:32 +02:00
parent 6188b6a8fc
commit aecf813f45
5 changed files with 46 additions and 79 deletions

View File

@ -17,7 +17,7 @@ jobs:
- name: Tag
id: tag
run: echo "name=helm-chart-$(make helm-chart-version)" >> $GITHUB_OUTPUT
run: echo "name=helm-chart-$(make helm-version)" >> $GITHUB_OUTPUT
- name: Generate manifests bundle
run: make manifests-bundle

View File

@ -53,6 +53,12 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
token: "${{ secrets.GHA_TOKEN }}"
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Login DockerHub
uses: docker/login-action@v3
@ -79,25 +85,10 @@ jobs:
# BUNDLE_VALIDATE_FLAGS: "--select-optional suite=operatorframework --select-optional name=multiarch"
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Updated OLM bundle (${{ needs.args.outputs.VERSION }})
commit_author: Martin Montes <martin11lrx@gmail.com>
branch: olm-${{ needs.args.outputs.VERSION }}-update
create_branch: true
- name: Create pull request
env:
GITHUB_TOKEN: "${{ secrets.GHA_TOKEN }}"
run: |
gh pr create \
-B ${{ github.event.repository.default_branch }} \
-H olm-${{ needs.args.outputs.VERSION }}-update \
--title 'Updated OLM bundle (${{ needs.args.outputs.VERSION }})' \
--body 'Automatically created by GitHub actions.'
gh pr merge \
olm-${{ needs.args.outputs.VERSION }}-update \
--auto --rebase --delete-branch
git add .
git commit -am "Updated OLM bundle (${{ needs.args.outputs.VERSION }})"
git push
- name: Publish bundle image
uses: docker/build-push-action@v6

View File

@ -183,44 +183,20 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docs:
name: Documentation
runs-on: ubuntu-latest
needs:
- args
- release
- release-ent
- goreleaser
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Dispatch docs workflow
run: |
gh workflow run docs.yaml \
--repo mariadb-operator/mariadb-operator \
-f version=${{ needs.args.outputs.TAG }} alias=latest
env:
GITHUB_TOKEN: "${{ secrets.GHA_TOKEN }}"
helm:
name: Helm
runs-on: ubuntu-latest
permissions:
contents: write
needs:
- args
- release
- release-ent
- goreleaser
- docs
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: "${{ secrets.GHA_TOKEN }}"
- name: Configure Git
run: |
@ -230,32 +206,16 @@ jobs:
- name: Helm version
id: version
run: |
VERSION=$(make helm-version-bump)
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "VERSION=$(make helm-version-bump)" >> $GITHUB_OUTPUT
- name: Helm generate
run: make helm-gen
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Updated helm chart (${{ steps.version.outputs.VERSION }})
commit_author: Martin Montes <martin11lrx@gmail.com>
branch: helm-${{ steps.version.outputs.VERSION }}-update
create_branch: true
- name: Create pull request
run: |
gh pr create \
-B ${{ github.event.repository.default_branch }} \
-H helm-${{ steps.version.outputs.VERSION }}-update \
--title 'Updated helm chart (${{ steps.version.outputs.VERSION }})' \
--body 'Automatically created by GitHub actions.'
gh pr merge \
helm-${{ steps.version.outputs.VERSION }}-update \
--auto --rebase --delete-branch
env:
GITHUB_TOKEN: "${{ secrets.GHA_TOKEN }}"
git add .
git commit -am "Updated helm chart (${{ steps.version.outputs.VERSION }})"
git push
olm:
name: OLM
@ -282,5 +242,27 @@ jobs:
run: |
git tag "olm-${{ needs.args.outputs.VERSION }}"
git push --tags
docs:
name: Documentation
runs-on: ubuntu-latest
needs:
- args
- release
- release-ent
- goreleaser
- helm
- olm
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Dispatch docs workflow
run: |
gh workflow run docs.yaml \
--repo mariadb-operator/mariadb-operator \
-f version=${{ needs.args.outputs.TAG }} alias=latest
env:
GITHUB_TOKEN: "${{ secrets.GHA_TOKEN }}"

View File

@ -80,17 +80,6 @@ POD ?= mariadb-repl-0
delete-pod: ## Continiously delete a Pod.
@while true; do kubectl delete pod $(POD); sleep 1; done;
##@ Helm
CT_IMG ?= quay.io/helmpack/chart-testing:v3.5.0
.PHONY: helm-lint
helm-lint: ## Lint Helm charts.
docker run --rm --workdir /repo -v $(shell pwd):/repo $(CT_IMG) ct lint --config .github/config/ct.yml
.PHONY: helm-chart-version
helm-chart-version: yq ## Get helm chart version.
@cat $(HELM_DIR)/Chart.yaml | $(YQ) e ".version"
##@ Install
PROMETHEUS_VERSION ?= "58.3.1"

View File

@ -3,6 +3,11 @@
HELM_DIR ?= deploy/charts/mariadb-operator
HELM_CHART_FILE ?= $(HELM_DIR)/Chart.yaml
HELM_CT_IMG ?= quay.io/helmpack/chart-testing:v3.5.0
.PHONY: helm-lint
helm-lint: ## Lint Helm charts.
docker run --rm --workdir /repo -v $(shell pwd):/repo $(HELM_CT_IMG) ct lint --config .github/config/ct.yml
.PHONY: helm-crds
helm-crds: kustomize ## Generate CRDs for the Helm chart.
$(KUSTOMIZE) build config/crd > $(HELM_DIR)/crds/crds.yaml
@ -33,12 +38,12 @@ helm-docs: ## Generate Helm chart docs.
.PHONY: helm-gen
helm-gen: helm-crds helm-env helm-docs ## Generate manifests and documentation for the Helm chart.
.PHONY: helm-version
helm-version: yq ## Get helm chart version.
@cat $(HELM_CHART_FILE) | $(YQ) e ".version"
.PHONY: helm-version-bump
helm-version-bump: yq ## Bump helm minor version and return it to stdout.
@if [ ! -f $(HELM_CHART_FILE) ]; then \
echo "Error: $(HELM_CHART_FILE) not found"; \
exit 1; \
fi; \
VERSION=$$($(YQ) e '.version' $(HELM_CHART_FILE)); \
MAJOR=$$(echo $$VERSION | cut -d'.' -f1); \
MINOR=$$(echo $$VERSION | cut -d'.' -f2); \