forked from cloudnative-pg/cloudnative-pg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae9a127
commit 3f3fdfb
Showing
6 changed files
with
109 additions
and
39 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,11 +17,12 @@ permissions: | |
|
||
jobs: | ||
|
||
check-branch: | ||
check-version: | ||
name: Evaluate release tag | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
is_latest: ${{ env.IS_LATEST }} | ||
is_stable: ${{ env.IS_STABLE }} | ||
steps: | ||
- | ||
name: Checkout | ||
|
@@ -30,7 +31,7 @@ jobs: | |
# To identify the commit we need the history and all the tags. | ||
fetch-depth: 0 | ||
- | ||
name: Check release branch | ||
name: Check release version | ||
run: | | ||
tag="${GITHUB_REF#refs/tags/v}" | ||
latest_release_branch=$(git branch -rl 'origin/release-*' | sort -r | head -n1 | sed -e 's/^.*\(release-.*\)/\1/') | ||
|
@@ -39,13 +40,18 @@ jobs: | |
if [[ "$latest_release_branch" == "$current_release_branch" ]]; then | ||
is_latest="true" | ||
fi | ||
is_stable="false" | ||
if [[ "$tag" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
is_stable="true" | ||
fi | ||
echo "IS_LATEST=${is_latest}" >> $GITHUB_ENV | ||
echo "IS_STABLE=${is_stable}" >> $GITHUB_ENV | ||
release: | ||
name: Create Github release | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- check-branch | ||
- check-version | ||
steps: | ||
- | ||
name: Checkout | ||
|
@@ -74,15 +80,16 @@ jobs: | |
draft: false | ||
name: v${{ env.TAG }} | ||
files: releases/cnpg-${{ env.VERSION }}.yaml | ||
make_latest: ${{ needs.check-branch.outputs.is_latest }} | ||
make_latest: ${{ needs.check-version.outputs.is_latest == 'true' && needs.check-version.outputs.is_stable == 'true' }} | ||
prerelease: ${{ needs.check-version.outputs.is_stable == 'false' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
release-binaries: | ||
name: Build containers | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- check-branch | ||
- check-version | ||
outputs: | ||
version: ${{ steps.build-meta.outputs.version }} | ||
author_name: ${{ steps.build-meta.outputs.author_name }} | ||
|
@@ -151,16 +158,22 @@ jobs: | |
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | ||
- | ||
name: Publish Krew | ||
if: ${{ needs.check-branch.outputs.is_latest == 'true' }} | ||
if: | | ||
needs.check-version.outputs.is_latest == 'true' && | ||
needs.check-version.outputs.is_stable == 'true' | ||
uses: rajatjindal/[email protected] | ||
with: | ||
krew_template_file: dist/krew/cnpg.yaml | ||
- | ||
name: Docker meta | ||
id: docker-meta | ||
uses: docker/metadata-action@v5 | ||
env: | ||
IS_LATEST: ${{ needs.check-version.outputs.is_latest == 'true' && needs.check-version.outputs.is_stable == 'true' }} | ||
with: | ||
images: ${{ env.IMAGES }} | ||
flavor: | | ||
latest=${{ env.IS_LATEST }} | ||
tags: | | ||
type=semver,pattern={{version}} | ||
- | ||
|
@@ -245,12 +258,13 @@ jobs: | |
name: Create OLM bundle and catalog | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- check-branch | ||
- check-version | ||
- release-binaries | ||
if: | | ||
(always() && !cancelled()) && | ||
needs.release-binaries.result == 'success' && | ||
needs.check-branch.outputs.is_latest == 'true' | ||
needs.check-version.outputs.is_latest == 'true' && | ||
needs.check-version.outputs.is_stable == 'true' | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
@@ -388,7 +402,6 @@ jobs: | |
- release-binaries | ||
if: | | ||
(always() && !cancelled()) && | ||
needs.release-binaries.result == 'success' && | ||
needs.olm-bundle.result == 'success' && | ||
github.repository_owner == 'cloudnative-pg' | ||
env: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,9 @@ on: | |
- closed | ||
branches: | ||
- release-* | ||
- main | ||
paths: | ||
- 'pkg/versions/versions.go' | ||
|
||
jobs: | ||
tag: | ||
|
@@ -21,6 +24,6 @@ jobs: | |
uses: christophebedard/[email protected] | ||
with: | ||
token: ${{ secrets.REPO_GHA_PAT }} | ||
version_regex: '^Version tag to ([0-9]+\.[0-9]+\.[0-9]+)' | ||
version_regex: '^Version tag to ([0-9]+\.[0-9]+\.[0-9]+(?:-[a-z][0-9a-z]*)?)' | ||
version_tag_prefix: v | ||
dry_run: false |
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
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
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