continuous-delivery #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: continuous-delivery | |
on: | |
push: | |
tags: | |
- '*' | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "What to tag the deployer image with" | |
required: true | |
cnpg_tag: | |
description: "What version of the CNPG chart to bundle" | |
required: true | |
jobs: | |
build: | |
name: Build chart | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GCR | |
uses: docker/login-action@v2 | |
with: | |
registry: gcr.io | |
username: _json_key | |
password: ${{ secrets.GCR_JSON_KEY }} | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.9.0 | |
id: install | |
# Steps to run on tag | |
- name: Parse major, minor, patch from tag | |
id: semver_parser | |
uses: booxmedialtd/ws-action-parse-semver@v1 | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
with: | |
input_string: ${{ github.ref }} | |
version_extractor_regex: '^refs/tags/[v]?(.*)$' | |
- name: Update CNPG chart by tag | |
run: make update-chart | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
env: | |
TAG: "${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }}.${{ steps.semver_parser.outputs.patch }}" | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
with: | |
context: . | |
push: true | |
provenance: false | |
tags: | | |
gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/deployer:latest | |
gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/deployer:${{ steps.semver_parser.outputs.fullversion }} | |
gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/deployer:${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }} | |
gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/deployer:${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }}.${{ steps.semver_parser.outputs.patch }} | |
build-args: | | |
TAG=${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }}.${{ steps.semver_parser.outputs.patch }} | |
- name: Pull CNPG image | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
run: | | |
docker pull ghcr.io/cloudnative-pg/cloudnative-pg:${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }}.${{ steps.semver_parser.outputs.patch }} | |
- name: Tag CNPG image | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
run: | | |
docker tag ghcr.io/cloudnative-pg/cloudnative-pg:${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }}.${{ steps.semver_parser.outputs.patch }} gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/cloudnative-pg:latest | |
docker tag ghcr.io/cloudnative-pg/cloudnative-pg:${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }}.${{ steps.semver_parser.outputs.patch }} gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/cloudnative-pg:${{ steps.semver_parser.outputs.fullversion }} | |
docker tag ghcr.io/cloudnative-pg/cloudnative-pg:${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }}.${{ steps.semver_parser.outputs.patch }} gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/cloudnative-pg:${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }} | |
docker tag ghcr.io/cloudnative-pg/cloudnative-pg:${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }}.${{ steps.semver_parser.outputs.patch }} gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/cloudnative-pg:${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }}.${{ steps.semver_parser.outputs.patch }} | |
- name: Push CNPG image tags | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
run: | | |
docker image push --all-tags gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/cloudnative-pg | |
##### | |
# Steps to run on dispatch | |
- name: Parse major, minor, patch from tag | |
id: semver_parser_dispatch | |
uses: booxmedialtd/ws-action-parse-semver@v1 | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
with: | |
input_string: ${{ inputs.tag }} | |
version_extractor_regex: '^[v]?(.*)$' | |
- name: Update CNPG chart by input | |
run: make update-chart | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
env: | |
TAG: ${{ inputs.cnpg_tag }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
with: | |
context: . | |
push: true | |
provenance: false | |
tags: | | |
gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/deployer:latest | |
gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/deployer:${{ steps.semver_parser_dispatch.outputs.fullversion }} | |
gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/deployer:${{ steps.semver_parser_dispatch.outputs.major }}.${{ steps.semver_parser_dispatch.outputs.minor }} | |
gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/deployer:${{ steps.semver_parser_dispatch.outputs.major }}.${{ steps.semver_parser_dispatch.outputs.minor }}.${{ steps.semver_parser_dispatch.outputs.patch }} | |
build-args: | | |
TAG=${{ steps.semver_parser_dispatch.outputs.major }}.${{ steps.semver_parser_dispatch.outputs.minor }}.${{ steps.semver_parser_dispatch.outputs.patch }} | |
- name: Pull CNPG image | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
run: | | |
docker pull ghcr.io/cloudnative-pg/cloudnative-pg:${{ steps.semver_parser_dispatch.outputs.major }}.${{ steps.semver_parser_dispatch.outputs.minor }}.${{ steps.semver_parser_dispatch.outputs.patch }} | |
- name: Tag CNPG image | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
run: | | |
docker tag ghcr.io/cloudnative-pg/cloudnative-pg:${{ steps.semver_parser_dispatch.outputs.major }}.${{ steps.semver_parser_dispatch.outputs.minor }}.${{ steps.semver_parser_dispatch.outputs.patch }} gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/cloudnative-pg:latest | |
docker tag ghcr.io/cloudnative-pg/cloudnative-pg:${{ steps.semver_parser_dispatch.outputs.major }}.${{ steps.semver_parser_dispatch.outputs.minor }}.${{ steps.semver_parser_dispatch.outputs.patch }} gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/cloudnative-pg:${{ steps.semver_parser_dispatch.outputs.fullversion }} | |
docker tag ghcr.io/cloudnative-pg/cloudnative-pg:${{ steps.semver_parser_dispatch.outputs.major }}.${{ steps.semver_parser_dispatch.outputs.minor }}.${{ steps.semver_parser_dispatch.outputs.patch }} gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/cloudnative-pg:${{ steps.semver_parser_dispatch.outputs.major }}.${{ steps.semver_parser_dispatch.outputs.minor }} | |
docker tag ghcr.io/cloudnative-pg/cloudnative-pg:${{ steps.semver_parser_dispatch.outputs.major }}.${{ steps.semver_parser_dispatch.outputs.minor }}.${{ steps.semver_parser_dispatch.outputs.patch }} gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/cloudnative-pg:${{ steps.semver_parser_dispatch.outputs.major }}.${{ steps.semver_parser_dispatch.outputs.minor }}.${{ steps.semver_parser_dispatch.outputs.patch }} | |
- name: Push CNPG image tags | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
run: | | |
docker image push --all-tags gcr.io/public-edb-ppas/edb-cnpg-gke-autopilot-dev/cloudnative-pg | |
##### |