Skip to content

Commit 225046f

Browse files
committed
Update workflows to support multiple branches
1 parent 81f5a74 commit 225046f

File tree

9 files changed

+37
-14
lines changed

9 files changed

+37
-14
lines changed

.github/workflows/container.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
push:
77
branches:
88
- "main"
9+
- "release-*"
910
tags:
1011
- "v*"
1112
paths-ignore:
@@ -22,6 +23,7 @@ jobs:
2223
build:
2324
name: Build Container
2425
runs-on: ubuntu-latest
26+
2527
steps:
2628
- name: Checkout repository
2729
uses: actions/checkout@v2.4.0
@@ -45,11 +47,15 @@ jobs:
4547
- name: Set up Docker Buildx
4648
uses: docker/setup-buildx-action@v1
4749

48-
- uses: actions/checkout@v2
49-
50-
- name: Fetch latest release version
51-
id: fetch-latest-release
52-
uses: reloc8/action-latest-release-version@1.0.0
50+
- name: Extract version from tag and determine latest
51+
run: |
52+
TAG="${{ github.ref_name }}"
53+
PATCH=$(echo "${TAG#v}" | cut -d. -f3)
54+
if [ "$PATCH" = "0" ]; then
55+
echo "TAG_LATEST=true" >> $GITHUB_ENV
56+
else
57+
echo "TAG_LATEST=false" >> $GITHUB_ENV
58+
fi
5359
5460
- name: Build And Push
5561
uses: docker/build-push-action@v2.8.0
@@ -59,5 +65,5 @@ jobs:
5965
push: ${{ startsWith(github.ref, 'refs/tags/') }}
6066
tags: |
6167
${{ steps.meta.outputs.tags }}
62-
coralogixrepo/coralogix-operator:${{ steps.fetch-latest-release.outputs.latest-release }}
63-
coralogixrepo/coralogix-operator:latest
68+
${{ env.DOCKERHUB_REGISTRY }}:${{ github.ref_name }}
69+
${{ env.TAG_LATEST == 'true' && format('{0}:latest', env.DOCKERHUB_REGISTRY) || '' }}

.github/workflows/e2e-tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ on:
55
push:
66
branches:
77
- main
8+
- release-*
89
paths-ignore:
910
- "charts/**"
1011
pull_request:
1112
branches:
1213
- main
14+
- release-*
1315
paths-ignore:
1416
- "charts/**"
1517
jobs:

.github/workflows/generated-files.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ on:
44
push:
55
branches:
66
- main
7+
- release-*
78
paths-ignore:
89
- "charts/**"
910
pull_request:
1011
branches:
1112
- main
13+
- release-*
1214
paths-ignore:
1315
- "charts/**"
1416

.github/workflows/helm-chart-deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches:
77
- main
8+
- release-*
89
paths:
910
- charts/coralogix-operator/Chart.yaml
1011

.github/workflows/helm-e2e-tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ on:
55
push:
66
branches:
77
- main
8+
- release-*
89
pull_request:
910
branches:
1011
- main
12+
- release-*
1113
jobs:
1214
tests:
1315
name: Tests

.github/workflows/helm-sync-check.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- "config/**"
88
branches:
99
- main
10+
- release-*
1011

1112
jobs:
1213
build:

.github/workflows/helm-update.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,32 @@ jobs:
1919
2020
- name: Update Chart Version
2121
run: |
22-
TAG="${{ github.ref_name }}"
23-
TAG_VERSION=$(echo $TAG | sed 's/v//')
24-
CURRENT_VERSION=$(grep "version:" charts/coralogix-operator/Chart.yaml | awk '{print $2}')
25-
NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. -v OFS=. '{$3+=1}1')
22+
TAG="${{ github.ref_name }}"
23+
VERSION="${TAG#v}"
24+
25+
sed -i "s/^appVersion:.*/appVersion: $VERSION/" charts/coralogix-operator/Chart.yaml
26+
sed -i "s/^version:.*/version: $VERSION/" charts/coralogix-operator/Chart.yaml
2627
27-
sed -i "s/appVersion:.*/appVersion: $TAG_VERSION/" charts/coralogix-operator/Chart.yaml
28-
sed -i "s/version:.*/version: $NEW_VERSION/" charts/coralogix-operator/Chart.yaml
2928
3029
- name: Update Chart version in Documentation
3130
run: make helm-sync-docs
3231

32+
- name: Extract Release Branch from Tag
33+
run: |
34+
TAG="${{ github.ref_name }}"
35+
VERSION="${TAG#v}"
36+
echo "RELEASE_BRANCH=$(echo "$VERSION" | cut -d. -f1,2)" >> $GITHUB_ENV
37+
3338
- name: Create Pull Request
3439
uses: peter-evans/create-pull-request@v3
3540
with:
3641
token: ${{ secrets.GITHUB_TOKEN }}
3742
commit-message: "Bump version and update appVersion in Chart.yaml"
3843
title: "Bump version and update appVersion in Chart.yaml"
39-
base: main
44+
base: release-${{ env.RELEASE_BRANCH }}
4045
branch: update-chart-version-${{ github.ref_name }}
4146
add-paths: |
4247
charts/coralogix-operator/Chart.yaml
48+
charts/coralogix-operator/README.md
4349
body: |
4450
This pull request bumps the version and updates the appVersion in Chart.yaml to match the tag.

.github/workflows/integration-tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ on:
55
push:
66
branches:
77
- main
8+
- release-*
89
paths-ignore:
910
- "charts/**"
1011
pull_request:
1112
branches:
1213
- main
14+
- release-*
1315
paths-ignore:
1416
- "charts/**"
1517
jobs:

.github/workflows/unit-tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
push:
77
branches:
88
- 'main'
9+
- 'release-*'
910
paths-ignore:
1011
- "charts/**"
1112
jobs:

0 commit comments

Comments
 (0)