Skip to content

Commit

Permalink
Added release workflows with chart-releaser (#5)
Browse files Browse the repository at this point in the history
Following the automated release process, this time for the helm chart. 
This patch includes some order on the workflows  plus the addition
of the chart-releaser action.

The steps to release can be found in the RELEASE.md file.

Co-authored-by: Jonathan Gonzalez V <[email protected]>
  • Loading branch information
phisco and sxd authored Jun 17, 2021
1 parent 04a1780 commit 77544bf
Show file tree
Hide file tree
Showing 24 changed files with 170 additions and 39 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
34 changes: 1 addition & 33 deletions .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,9 @@
name: continuous-delivery

on:
push:
pull_request:

jobs:
linter:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.4.0

- uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch=main)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: ct lint --target-branch=main

install_deploy:
runs-on: ubuntu-20.04
steps:
Expand All @@ -55,7 +23,7 @@ jobs:
- name: Deploy using helm chart
run: |
helm upgrade --install cnp --namespace postgresql-operator-system \
--create-namespace cloud-native-postgresql --wait
--create-namespace charts/cloud-native-postgresql --wait
- name: Install kubectl
uses: azure/setup-kubectl@v1
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: linter

on:
push:

jobs:
linter:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.4.0

- uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch=main)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: ct lint --target-branch=main
31 changes: 31 additions & 0 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Create a PR for a release when a commit is pushed on a release/v* branch

name: release-pr

on:
push:
branches:
- release/v*

jobs:
pull-request:
runs-on: ubuntu-20.04
steps:
-
name: Checkout
uses: actions/[email protected]
-
name: Get tag
run: |
echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
-
name: Pull Request
id: open-pr
uses: repo-sync/[email protected]
with:
destination_branch: "main"
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_body: "Automated PR. Will trigger the ${{ env.TAG }} release when approved."
pr_label: release
pr_title: "Release ${{ env.TAG }}"

30 changes: 30 additions & 0 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: release-publish

on:
push:
tags:
- v*

jobs:
release:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.4.0

- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
28 changes: 28 additions & 0 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Create a tag when a PR on a release/v* branch is merged

name: release-tag

on:
pull_request:
types:
- closed
branches:
- main

jobs:
tag:
runs-on: ubuntu-20.04
steps:
-
name: Checkout
uses: actions/[email protected]
-
name: Create tag
if: github.event.pull_request.merged == true && startsWith(${{ github.head_ref }}, "release/v")
uses: christophebedard/[email protected]
with:
token: ${{ secrets.REPO_GHA_PAT }}
version_regex: '^Version tag to ([0-9]+\.[0-9]+\.[0-9]+)'
version_tag_prefix: v
dry_run: false

14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,25 @@ designed by EnterpriseDB to manage PostgreSQL workloads on any
supported Kubernetes cluster running in private, public, or hybrid cloud
environments.

## Deployment
## Deployment using the latest release

```console
helm repo add cnp https://enterprisedb.github.io/cloud-native-postgresql-helm/
helm upgrade --install cnp \
--namespace postgresql-operator-system \
--create-namespace \
cnp/cloud-native-postgresql
```

## Deployment using local chart

To deploy the operator from sources you can run the following command:

```console
helm upgrade --install cnp \
--namespace postgresql-operator-system \
--create-namespace \
cloud-native-postgresql
charts/cloud-native-postgresql
```

## Copyright
Expand Down
19 changes: 19 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Cloud Native PostgreSQL release procedure

**Steps:**

The following steps assume version 0.2.0 as the one to be released. Alter the
instructions accordingly.

1. Create branch `release/v0.2.0`
1. Approve the PR that is automatically generated.
1. The tag 0.2.0 will be created when the PR is merged.
1. The helm chart will be automatically added to the chart index.

To check the chart was updated correctly, run:
```bash
helm repo add cnp https://enterprisedb.github.io/cloud-native-postgresql-helm/
# or "helm repo update" if already added
helm search repo cnp
```
and you should see the latest version available.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ keywords:
- postgres
- database
home: https://www.enterprisedb.com/products/postgresql-on-kubernetes-ha-clusters-k8s-containers-scalable
maintainers:
- name: phisco
email: [email protected]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ webhook:
config:
create: true
data: {}
#INHERITED_ANNOTATIONS: categories
#INHERITED_LABELS: environment, workload, app
#EDB_LICENSE_KEY: <YOUR_EDB_LICENSE_KEY_HERE>
# INHERITED_ANNOTATIONS: categories
# INHERITED_LABELS: environment, workload, app
# EDB_LICENSE_KEY: <YOUR_EDB_LICENSE_KEY_HERE>
name: postgresql-operator-controller-manager-config

# -- Additinal arguments to be added to the operator's args list
additionalArgs: []
additionalArgs: []

serviceAccount:
# -- Specifies whether a service account should be created
Expand Down

0 comments on commit 77544bf

Please sign in to comment.