|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + increment: |
| 7 | + description: "Version increment type" |
| 8 | + type: choice |
| 9 | + required: true |
| 10 | + default: "Patch" |
| 11 | + options: |
| 12 | + - "Major" |
| 13 | + - "Minor" |
| 14 | + - "Patch" |
| 15 | + - "Prerelease" |
| 16 | + |
| 17 | +env: |
| 18 | + DOCKER_IMAGE: ghcr.io/${{ github.repository }} |
| 19 | + |
| 20 | +jobs: |
| 21 | + test: |
| 22 | + uses: ./.github/workflows/test.yml |
| 23 | + secrets: inherit |
| 24 | + |
| 25 | + build-and-release: |
| 26 | + needs: test |
| 27 | + runs-on: ubuntu-24.04 |
| 28 | + timeout-minutes: 15 |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v6 |
| 31 | + with: |
| 32 | + token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} |
| 33 | + - uses: aboutbits/github-actions-base/git-setup@v2 |
| 34 | + - uses: aboutbits/github-actions-java/setup-with-gradle@v4 |
| 35 | + with: |
| 36 | + java-version: 25 |
| 37 | + cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} |
| 38 | + - name: Increment version |
| 39 | + run: ./gradlew --console=colored createRelease -Prelease.versionIncrementer=increment${{ github.event.inputs.increment }} |
| 40 | + shell: bash |
| 41 | + - name: Get next package version |
| 42 | + id: nextVersion |
| 43 | + run: echo "version=$(./gradlew currentVersion -q -Prelease.quiet)" >> $GITHUB_OUTPUT |
| 44 | + shell: bash |
| 45 | + - name: Build package |
| 46 | + run: ./gradlew --console=colored build -x test |
| 47 | + - name: Build Docker image |
| 48 | + uses: aboutbits/github-actions-docker/build-push@v1 |
| 49 | + with: |
| 50 | + username: ${{ github.actor }} |
| 51 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + docker-image: ${{ env.DOCKER_IMAGE }} |
| 53 | + docker-tag: ${{ steps.nextVersion.outputs.version }} |
| 54 | + working-directory: './operator' |
| 55 | + dockerfile: './operator/src/main/docker/Dockerfile.jvm' |
| 56 | + - name: Push tag to remote |
| 57 | + run: ./gradlew --console=colored pushRelease |
| 58 | + shell: bash |
| 59 | + - uses: aboutbits/github-actions-base/github-create-release@v2 |
| 60 | + with: |
| 61 | + tag-name: 'v${{ steps.nextVersion.outputs.version }}' |
| 62 | + release-description: | |
| 63 | + ## Installation |
| 64 | +
|
| 65 | + ### Helm Chart |
| 66 | + ```bash |
| 67 | + helm install postgresql-operator https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/postgresql-operator-${{ steps.nextVersion.outputs.version }}.tgz |
| 68 | + ``` |
| 69 | + |
| 70 | + ### Manual CRD Installation |
| 71 | + ```bash |
| 72 | + kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/clusterconnections.postgresql.aboutbits.it-v1.yml |
| 73 | + kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/databases.postgresql.aboutbits.it-v1.yml |
| 74 | + kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/schemas.postgresql.aboutbits.it-v1.yml |
| 75 | + kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/roles.postgresql.aboutbits.it-v1.yml |
| 76 | + kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/grants.postgresql.aboutbits.it-v1.yml |
| 77 | + kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/defaultprivileges.postgresql.aboutbits.it-v1.yml |
| 78 | + ``` |
| 79 | + release-notes-generation: 'true' |
| 80 | + - name: Upload Helm chart and CRD assets |
| 81 | + env: |
| 82 | + GH_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} |
| 83 | + run: | |
| 84 | + gh release upload v${{ steps.nextVersion.outputs.version }} operator/build/helm/kubernetes/*.tgz operator/build/kubernetes/*.postgresql.aboutbits.it-v1.yml |
| 85 | + shell: bash |
0 commit comments