-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (94 loc) · 4.79 KB
/
release.yml
File metadata and controls
101 lines (94 loc) · 4.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Release
on:
workflow_dispatch:
inputs:
increment:
description: "Version increment type"
type: choice
required: true
default: "Patch"
options:
- "Major"
- "Minor"
- "Patch"
- "Prerelease"
env:
DOCKER_IMAGE: ghcr.io/${{ github.repository }}
jobs:
test:
uses: ./.github/workflows/test.yml
secrets: inherit
build-and-release:
needs: test
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
- uses: aboutbits/github-actions-base/git-setup@v2
- uses: aboutbits/github-actions-java/setup-with-gradle@v4
with:
java-version: 25
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: Increment version
run: ./gradlew --console=colored createRelease -Prelease.versionIncrementer=increment${{ github.event.inputs.increment }}
shell: bash
- name: Get next package version
id: nextVersion
run: echo "version=$(./gradlew currentVersion -q -Prelease.quiet)" >> $GITHUB_OUTPUT
shell: bash
- name: Build package
run: ./gradlew --console=colored build -x test
env:
GITHUB_USER_NAME: ${{ github.actor }}
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Package Helm chart
run: |
tar -czf operator/build/helm/kubernetes/postgresql-operator-${{ steps.nextVersion.outputs.version }}.tgz -C operator/build/helm/kubernetes postgresql-operator
shell: bash
- uses: aboutbits/github-actions-docker/build-push@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
docker-image: ${{ env.DOCKER_IMAGE }}
docker-tag: ${{ steps.nextVersion.outputs.version }}
working-directory: './operator'
dockerfile: './operator/src/main/docker/Dockerfile.jvm'
- name: Push tag to remote
run: ./gradlew --console=colored pushRelease
shell: bash
- uses: aboutbits/github-actions-base/github-create-release@v2
with:
tag-name: 'v${{ steps.nextVersion.outputs.version }}'
release-description: |
## Installation
### Helm Chart
```bash
helm install postgresql-operator https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/postgresql-operator-${{ steps.nextVersion.outputs.version }}.tgz
```
With the Helm chart, the Custom Resource Definitions (CRDs) are installed automatically.
However, if you deploy the operator directly from the OCI image, the CRDs are not automatically applied and must be installed separately.
### Manual CRD Installation
```bash
kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/clusterconnections.postgresql.aboutbits.it-v1.yml
kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/databases.postgresql.aboutbits.it-v1.yml
kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/schemas.postgresql.aboutbits.it-v1.yml
kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/roles.postgresql.aboutbits.it-v1.yml
kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/grants.postgresql.aboutbits.it-v1.yml
kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/defaultprivileges.postgresql.aboutbits.it-v1.yml
```
release-notes-generation: 'true'
- name: Upload Helm chart and CRD assets
env:
GH_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
run: |
gh release upload v${{ steps.nextVersion.outputs.version }} operator/build/helm/kubernetes/postgresql-operator-${{ steps.nextVersion.outputs.version }}.tgz operator/build/kubernetes/*.postgresql.aboutbits.it-v1.yml
shell: bash
- name: Update README.md
run: |
sed -i "s|releases/download/v[0-9.]*/postgresql-operator-[0-9.]*.tgz|releases/download/v${{ steps.nextVersion.outputs.version }}/postgresql-operator-${{ steps.nextVersion.outputs.version }}.tgz|g" README.md
git add README.md
git diff-index --quiet HEAD || git commit -m "update README.md with version ${{ steps.nextVersion.outputs.version }}"
git push
shell: bash