-
Notifications
You must be signed in to change notification settings - Fork 3
85 lines (79 loc) · 3.78 KB
/
Copy pathrelease.yml
File metadata and controls
85 lines (79 loc) · 3.78 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
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:
build-and-publish:
runs-on: ubuntu-24.04
timeout-minutes: 15
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
- name: Build Docker image
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
**Docker Image:**
```bash
docker pull ${{ env.DOCKER_IMAGE }}:${{ steps.nextVersion.outputs.version }}
```
**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
```
**Manually installing CRDs:**
```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/*.tgz operator/build/kubernetes/*.postgresql.aboutbits.it-v1.yml
shell: bash