Skip to content

Commit f20da9c

Browse files
authored
feat: add self-service registration components and styles (#3)
* feat: add self-service registration components and styles feat: implement self-service registration and home page with FAQs feat: add self-service check functionality and integrate QR code processing feat: enhance self-service functionality with QR code processing and reward redemption features feat: add gift redemption functionality with QR code support and availability check feat: add participation dialog and integrate with self-service home page * feat: update button styles to contained for better visibility and user experience * feat: update stock handling for self-service rewards to support unlimited stock * feat: implement CI/CD workflows for development and production environments * feat: remove pull_request trigger from CI/CD workflows for dev and prod branches * feat: update CI/CD workflows to use Docker Hub credentials instead of GCP * feat: update ArgoCD workflows to include argocd_values_file and adjust image repository paths
1 parent 0517d27 commit f20da9c

24 files changed

Lines changed: 1716 additions & 55 deletions

‎.github/workflows/dev-0-ci-cd.yaml‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Dev CI/CD
2+
on:
3+
push:
4+
branches:
5+
- dev
6+
jobs:
7+
build:
8+
if: github.ref == 'refs/heads/dev'
9+
uses: ./.github/workflows/dev-1-ci.yaml
10+
with:
11+
environment: dev
12+
image_repository: ${{ vars.DOCKER_IMAGE }}
13+
push_image: ${{ github.event_name == 'push' }}
14+
secrets:
15+
docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }}
16+
docker_hub_access_token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
17+
18+
deploy:
19+
if: github.ref == 'refs/heads/dev'
20+
uses: ./.github/workflows/dev-2-cd.yaml
21+
needs: build
22+
with:
23+
environment: dev
24+
image_repository: ${{ vars.DOCKER_IMAGE }}
25+
image_tag: ${{ needs.build.outputs.image_tag }}
26+
deployment_repository: ${{ vars.ARGOCD_REPOSITORY }}
27+
deployment_ref: ${{ vars.ARGOCD_REF || 'main' }}
28+
image_repository_path: ${{ vars.ARGOCD_IMAGE_REPOSITORY_PATH || 'control-front.image.repository' }}
29+
image_tag_path: ${{ vars.ARGOCD_IMAGE_TAG_PATH || 'control-front.image.tag' }}
30+
argocd_values_file: ${{ vars.ARGOCD_VALUES_FILE }}
31+
secrets:
32+
token: ${{ secrets.ARGOCD_GH_TOKEN }}

‎.github/workflows/dev-1-ci.yaml‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Dev CI - Build and Push Image
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
environment:
7+
description: GitHub Environment used for this build
8+
required: true
9+
type: string
10+
image_repository:
11+
description: Docker Hub image repository for the dev environment
12+
required: true
13+
type: string
14+
push_image:
15+
description: Whether to push the image to Docker Hub
16+
required: false
17+
default: false
18+
type: boolean
19+
secrets:
20+
docker_hub_username:
21+
required: false
22+
docker_hub_access_token:
23+
required: false
24+
outputs:
25+
image_tag:
26+
description: Tag of the built dev image
27+
value: ${{ jobs.build.outputs.image_tag }}
28+
29+
jobs:
30+
build:
31+
name: Build dev image
32+
runs-on: ubuntu-latest
33+
environment: ${{ inputs.environment }}
34+
outputs:
35+
image_tag: ${{ steps.image.outputs.tag }}
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
40+
- name: Validate image repository
41+
env:
42+
IMAGE_REPOSITORY: ${{ inputs.image_repository }}
43+
run: test -n "$IMAGE_REPOSITORY"
44+
45+
- name: Set image tag
46+
id: image
47+
run: echo "tag=dev-${GITHUB_SHA}" >> "$GITHUB_OUTPUT"
48+
49+
- name: Set up QEMU
50+
uses: docker/setup-qemu-action@v3
51+
52+
- name: Set up Docker Buildx
53+
uses: docker/setup-buildx-action@v3
54+
55+
- name: Login to Docker Hub
56+
if: inputs.push_image
57+
uses: docker/login-action@v4
58+
with:
59+
username: ${{ secrets.docker_hub_username }}
60+
password: ${{ secrets.docker_hub_access_token }}
61+
62+
- name: Build and push
63+
uses: docker/build-push-action@v6
64+
with:
65+
context: .
66+
platforms: linux/amd64,linux/arm64
67+
push: ${{ inputs.push_image }}
68+
tags: |
69+
${{ inputs.image_repository }}:${{ steps.image.outputs.tag }}
70+
${{ inputs.image_repository }}:dev-latest
71+
build-args: |
72+
NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }}
73+
cache-from: type=gha,scope=dev
74+
cache-to: type=gha,mode=max,scope=dev

‎.github/workflows/dev-2-cd.yaml‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Dev CD - Update Image on Deployment Repository
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
environment:
7+
description: GitHub Environment used for this deployment
8+
required: true
9+
type: string
10+
image_repository:
11+
required: true
12+
type: string
13+
image_tag:
14+
required: true
15+
type: string
16+
deployment_repository:
17+
required: true
18+
type: string
19+
deployment_ref:
20+
required: false
21+
default: main
22+
type: string
23+
image_repository_path:
24+
required: false
25+
default: .image.repository
26+
type: string
27+
image_tag_path:
28+
required: false
29+
default: .image.tag
30+
type: string
31+
argocd_values_file:
32+
required: true
33+
type: string
34+
secrets:
35+
token:
36+
required: true
37+
38+
jobs:
39+
update-image:
40+
name: Update dev image in GitOps repository
41+
runs-on: ubuntu-latest
42+
environment: ${{ inputs.environment }}
43+
steps:
44+
- name: Checkout deployment repository
45+
uses: actions/checkout@v4
46+
with:
47+
repository: ${{ inputs.deployment_repository }}
48+
ref: ${{ inputs.deployment_ref }}
49+
token: ${{ secrets.token }}
50+
path: deployment-config
51+
52+
- name: Set up yq
53+
uses: shiipou/setup-yq-action@v2.2.0
54+
55+
- name: Update image repository and tag
56+
env:
57+
VALUES_FILE: ${{ vars.ARGOCD_VALUES_FILE }}
58+
IMAGE_REPOSITORY: ${{ inputs.image_repository }}
59+
IMAGE_TAG: ${{ inputs.image_tag }}
60+
IMAGE_REPOSITORY_PATH: ${{ inputs.image_repository_path }}
61+
IMAGE_TAG_PATH: ${{ inputs.image_tag_path }}
62+
run: |
63+
test -n "$VALUES_FILE"
64+
test -f "deployment-config/$VALUES_FILE"
65+
yq -i 'eval(strenv(IMAGE_REPOSITORY_PATH)) = strenv(IMAGE_REPOSITORY) | eval(strenv(IMAGE_TAG_PATH)) = strenv(IMAGE_TAG)' "deployment-config/$VALUES_FILE"
66+
67+
git -C deployment-config config user.email "github-actions[bot]@users.noreply.github.com"
68+
git -C deployment-config config user.name "github-actions[bot]"
69+
git -C deployment-config add "$VALUES_FILE"
70+
if git -C deployment-config diff --cached --quiet; then
71+
echo "Image values are already up to date."
72+
else
73+
git -C deployment-config commit -m "Deploy dev image $IMAGE_TAG"
74+
git -C deployment-config push
75+
fi

‎.github/workflows/docker-image.yml‎

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Prod CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
if: github.ref == 'refs/heads/main'
11+
uses: ./.github/workflows/prod-1-ci.yaml
12+
with:
13+
environment: prod
14+
image_repository: ${{ vars.DOCKER_IMAGE }}
15+
push_image: ${{ github.event_name == 'push' }}
16+
secrets:
17+
docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }}
18+
docker_hub_access_token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
19+
20+
deploy:
21+
if: github.ref == 'refs/heads/main'
22+
uses: ./.github/workflows/prod-2-cd.yaml
23+
needs: build
24+
with:
25+
environment: prod
26+
image_repository: ${{ vars.DOCKER_IMAGE }}
27+
image_tag: ${{ needs.build.outputs.image_tag }}
28+
deployment_repository: ${{ vars.ARGOCD_REPOSITORY }}
29+
deployment_ref: ${{ vars.ARGOCD_REF || 'main' }}
30+
image_repository_path: ${{ vars.ARGOCD_IMAGE_REPOSITORY_PATH || 'control-front.image.repository' }}
31+
image_tag_path: ${{ vars.ARGOCD_IMAGE_TAG_PATH || 'control-front.image.tag' }}
32+
argocd_values_file: ${{ vars.ARGOCD_VALUES_FILE }}
33+
secrets:
34+
token: ${{ secrets.ARGOCD_GH_TOKEN }}

‎.github/workflows/prod-1-ci.yaml‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Prod CI - Build and Push Image
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
environment:
7+
description: GitHub Environment used for this build
8+
required: true
9+
type: string
10+
image_repository:
11+
description: Docker Hub image repository
12+
required: true
13+
type: string
14+
push_image:
15+
description: Whether to push the image to Docker Hub
16+
required: false
17+
default: false
18+
type: boolean
19+
secrets:
20+
docker_hub_username:
21+
required: false
22+
docker_hub_access_token:
23+
required: false
24+
outputs:
25+
image_tag:
26+
description: Tag of the built production image
27+
value: ${{ jobs.build.outputs.image_tag }}
28+
29+
jobs:
30+
build:
31+
name: Build production image
32+
runs-on: ubuntu-latest
33+
environment: ${{ inputs.environment }}
34+
outputs:
35+
image_tag: ${{ steps.image.outputs.tag }}
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
40+
- name: Validate image repository
41+
env:
42+
IMAGE_REPOSITORY: ${{ inputs.image_repository }}
43+
run: test -n "$IMAGE_REPOSITORY"
44+
45+
- name: Set image tag
46+
id: image
47+
run: echo "tag=${GITHUB_SHA}" >> "$GITHUB_OUTPUT"
48+
49+
- name: Set up QEMU
50+
uses: docker/setup-qemu-action@v3
51+
52+
- name: Set up Docker Buildx
53+
uses: docker/setup-buildx-action@v3
54+
55+
- name: Login to Docker Hub
56+
if: inputs.push_image
57+
uses: docker/login-action@v4
58+
with:
59+
username: ${{ secrets.docker_hub_username }}
60+
password: ${{ secrets.docker_hub_access_token }}
61+
62+
- name: Build and push
63+
uses: docker/build-push-action@v6
64+
with:
65+
context: .
66+
platforms: linux/amd64,linux/arm64
67+
push: ${{ inputs.push_image }}
68+
tags: |
69+
${{ inputs.image_repository }}:${{ steps.image.outputs.tag }}
70+
${{ inputs.image_repository }}:latest
71+
build-args: |
72+
NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }}
73+
cache-from: type=gha,scope=prod
74+
cache-to: type=gha,mode=max,scope=prod

0 commit comments

Comments
 (0)