Skip to content

Commit 56458dd

Browse files
authored
Merge pull request #80 from bcgov/dev
chore: release
2 parents 8a5ebca + 1d94a4c commit 56458dd

File tree

1 file changed

+43
-7
lines changed

1 file changed

+43
-7
lines changed

.github/workflows/deploy-aggregator.yaml

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,50 @@ env:
1515
IMAGE_NAME: bcgov/sso-aggregator
1616

1717
jobs:
18+
create_release:
19+
# Only release on push to main
20+
if: (github.ref == 'refs/heads/main' && github.event_name == 'push')
21+
runs-on: ubuntu-24.04
22+
permissions:
23+
contents: write
24+
outputs:
25+
tag: ${{ steps.release.outputs.tag_name }}
26+
steps:
27+
- name: Create Release
28+
id: release
29+
uses: rymndhng/release-on-push-action@v0.28.0
30+
with:
31+
bump_version_scheme: patch
32+
tag_prefix: v
33+
use_github_release_notes: 'true'
34+
release_name: Release <RELEASE_VERSION>
35+
max_commits: 100
36+
37+
set-tag:
38+
needs: [create_release]
39+
if: always()
40+
permissions:
41+
contents: read
42+
runs-on: ubuntu-latest
43+
outputs:
44+
tag: ${{ steps.set.outputs.tag }}
45+
steps:
46+
- name: Set tag based on context
47+
id: set
48+
run: |
49+
if [[ "${GITHUB_REF##*/}" == "main" ]]; then
50+
echo "::set-output name=tag::${{ needs.create_release.outputs.tag }}"
51+
else
52+
echo "::set-output name=tag::dev"
53+
fi
54+
1855
build-and-push-image:
1956
runs-on: ubuntu-24.04
2057
permissions:
2158
contents: read
2259
packages: write
23-
60+
needs: set-tag
61+
if: always()
2462
steps:
2563
- uses: actions/checkout@v4
2664
- name: Install CLI tools from OpenShift Mirror
@@ -41,19 +79,16 @@ jobs:
4179

4280
- name: Extract metadata (tags, labels) for Docker
4381
id: meta
44-
uses: docker/metadata-action@v4
82+
uses: docker/metadata-action@v5
4583
with:
4684
images: ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}
47-
tags: |
48-
type=ref,event=branch
49-
type=sha,format=long
5085

5186
- name: Build and push Docker image
5287
uses: docker/build-push-action@v3
5388
with:
5489
context: aggregator
5590
push: true
56-
tags: ${{ steps.meta.outputs.tags }}
91+
tags: ${{ format('{0}/{1}:{2}', env.GITHUB_REGISTRY, env.IMAGE_NAME, needs.set-tag.outputs.tag) }}
5792
labels: ${{ steps.meta.outputs.labels }}
5893

5994
- name: Set env to Sandbox
@@ -84,5 +119,6 @@ jobs:
84119
- name: Deploy aggregator with Helm chart
85120
run: |
86121
namespace=${{ env.OPENSHIFT_NAMESPACE }}
87-
make upgrade NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }}
122+
helm upgrade --install sso-aggregator . -n ${namespace} \
123+
-f values.yaml -f "values-${namespace}.yaml" --set image.tag="${{ needs.set-tag.outputs.tag }}"
88124
working-directory: ./helm/aggregator

0 commit comments

Comments
 (0)