Skip to content

Commit 06ac0f6

Browse files
committed
feat: enhance frontend workflows with versioning and default configurations
1 parent 84b8f28 commit 06ac0f6

File tree

6 files changed

+245
-16
lines changed

6 files changed

+245
-16
lines changed

.github/workflows/frontend-deploy-workflow-v2.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
name: Frontend Deploy Workflow
22

3-
# Version: v2 (with testing support)
4-
# Version tracking: See workflow-version output and WORKFLOW_VERSION/WORKFLOW_FILE env vars
3+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4+
# 📋 WORKFLOW VERSION CONFIGURATION
5+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
6+
#
7+
# This is the ONLY place you need to update the version number.
8+
# All version references throughout this workflow use these values.
9+
#
10+
# WORKFLOW_VERSION: Short version identifier (v1, v2, v3, etc.)
11+
# WORKFLOW_FILE: Full filename without extension
12+
#
13+
# When creating a new version:
14+
# 1. Copy this file to a new filename (e.g., frontend-deploy-workflow-v3.yml)
15+
# 2. Update ONLY these two values below
16+
# 3. Everything else will automatically use the new version
17+
#
18+
env:
19+
WORKFLOW_VERSION: 'v2'
20+
WORKFLOW_FILE: 'frontend-deploy-workflow-v2'
21+
#
22+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
523

624
on:
725
workflow_call:
@@ -288,9 +306,9 @@ jobs:
288306
id: artifact-info
289307
run: |
290308
echo "name=build-${{ github.run_id }}" >> $GITHUB_OUTPUT
291-
echo "version=v2" >> $GITHUB_OUTPUT
309+
echo "version=${{ env.WORKFLOW_VERSION }}" >> $GITHUB_OUTPUT
292310
echo "📦 Build artifact: build-${{ github.run_id }}"
293-
echo "📋 Workflow version: v2 (frontend-deploy-workflow-v2)"
311+
echo "📋 Workflow version: ${{ env.WORKFLOW_VERSION }} (${{ env.WORKFLOW_FILE }})"
294312
295313
- name: Upload build artifacts
296314
uses: actions/upload-artifact@v4
@@ -616,7 +634,7 @@ jobs:
616634
JARVIS_DATADOG_SITE: datadoghq.com
617635
JARVIS_DATADOG_SERVICE: ${{ inputs.jarvis-datadog-service }}
618636
JARVIS_DATADOG_ENV: ${{ inputs.jarvis-datadog-env }}
619-
JARVIS_DATADOG_TAGS: 'workflow_version:v2,workflow_file:frontend-deploy-workflow-v2'
637+
JARVIS_DATADOG_TAGS: 'workflow_version:${{ env.WORKFLOW_VERSION }},workflow_file:${{ env.WORKFLOW_FILE }}'
620638
# Production-specific secrets
621639
LINEARB_API_KEY: ${{ secrets.LINEARB_API_KEY }}
622640
DATADOG_API_KEY_FRONTEND_METRICS: ${{ secrets.DATADOG_API_KEY_FRONTEND_METRICS }}
@@ -628,8 +646,8 @@ jobs:
628646
if: inputs.jarvis-datadog-enabled
629647
run: |
630648
npx --yes @datadog/datadog-ci@latest tag --level pipeline \
631-
--tags "workflow_version:v2" \
632-
--tags "workflow_file:frontend-deploy-workflow-v2"
649+
--tags "workflow_version:${{ env.WORKFLOW_VERSION }}" \
650+
--tags "workflow_file:${{ env.WORKFLOW_FILE }}"
633651
env:
634652
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
635653
DATADOG_SITE: datadoghq.com

.github/workflows/frontend-deploy-workflow.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2+
# ⚠️ THIS FILE IS A COPY OF frontend-deploy-workflow-v1.yml
3+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4+
#
5+
# This is the "default" workflow that projects use when they don't specify a version.
6+
# It is intentionally a copy of the latest stable version to avoid delegation complexity.
7+
#
8+
# 📋 Version History:
9+
# - 2026-02-04: Synced from frontend-deploy-workflow-v1.yml (original, no testing)
10+
#
11+
# 🔄 To promote a new version to default:
12+
# 1. Copy the new version file content here (e.g., from frontend-deploy-workflow-v2.yml)
13+
# 2. Update the version history above
14+
# 3. Keep the versioned files unchanged for explicit version pinning
15+
#
16+
# 📌 Projects can pin to specific versions:
17+
# - frontend-deploy-workflow-v1.yml (original, no testing support)
18+
# - frontend-deploy-workflow-v2.yml (with testing support)
19+
# - frontend-deploy-workflow.yml (this file - currently v1)
20+
#
21+
# 📖 See: ../ci-consolidation/workflow-versioning-strategy.md
22+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
23+
124
name: Frontend Deploy Workflow
225

326
on:
@@ -285,4 +308,4 @@ jobs:
285308
echo "✅ Deployed to production"
286309
echo "📦 App: ${{ inputs.app-name }}"
287310
echo "🌐 CDN: ${{ inputs.cdn-url }}"
288-
echo "📝 Commit: ${{ github.sha }}"
311+
echo "📝 Commit: ${{ github.sha }}"
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Library PR & Release Workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
# Node configuration
7+
node-version:
8+
description: 'Node.js version'
9+
type: string
10+
default: '20'
11+
12+
# Runner configuration
13+
runner:
14+
description: 'Runner to use'
15+
type: string
16+
default: '["self-hosted", "ci-universal"]'
17+
18+
# Commands
19+
lint-command:
20+
description: 'Lint command'
21+
type: string
22+
default: 'yarn lint'
23+
24+
test-command:
25+
description: 'Test command'
26+
type: string
27+
default: 'yarn test --coverage'
28+
29+
build-command:
30+
description: 'Build command (optional, leave empty to skip)'
31+
type: string
32+
default: ''
33+
34+
# Semantic Release
35+
run-semantic-release:
36+
description: 'Run semantic-release on specified branches'
37+
type: boolean
38+
default: true
39+
40+
semantic-release-branches:
41+
description: 'Branches to run semantic-release on (JSON array)'
42+
type: string
43+
default: '["main", "beta", "alpha", "next"]'
44+
45+
# SonarCloud
46+
run-sonarcloud:
47+
description: 'Run SonarCloud scan'
48+
type: boolean
49+
default: true
50+
51+
sonar-project-key:
52+
description: 'SonarCloud project key (defaults to repository name)'
53+
type: string
54+
default: ''
55+
56+
# Timeouts
57+
timeout-minutes:
58+
description: 'Job timeout in minutes'
59+
type: number
60+
default: 15
61+
62+
secrets:
63+
GH_TOKEN:
64+
required: true
65+
SONAR_CLOUD_TOKEN:
66+
required: false
67+
68+
permissions:
69+
contents: write
70+
pull-requests: write
71+
72+
# Concurrency control: Cancel old runs for PRs, never cancel for main branch
73+
concurrency:
74+
group: ${{ github.workflow }}-${{ github.ref }}
75+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
76+
77+
jobs:
78+
checks-and-release:
79+
name: 🔍 Checks & Release
80+
runs-on: ${{ fromJSON(inputs.runner) }}
81+
timeout-minutes: ${{ inputs.timeout-minutes }}
82+
83+
steps:
84+
- name: Check out Git repository
85+
uses: actions/checkout@v4
86+
with:
87+
fetch-depth: 0 # Required for SonarCloud and semantic-release
88+
89+
- name: Setup Node with Cache
90+
uses: Typeform/.github/shared-actions/setup-node-with-cache@main
91+
with:
92+
node-version: ${{ inputs.node-version }}
93+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
94+
95+
- name: Run linters
96+
run: ${{ inputs.lint-command }}
97+
98+
- name: Run tests
99+
run: ${{ inputs.test-command }}
100+
101+
- name: Build (if specified)
102+
if: inputs.build-command != ''
103+
run: ${{ inputs.build-command }}
104+
105+
- name: Semantic Release
106+
if: |
107+
inputs.run-semantic-release &&
108+
contains(fromJSON(inputs.semantic-release-branches), github.ref_name)
109+
run: yarn semantic-release
110+
env:
111+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
112+
NPM_TOKEN: ${{ secrets.GH_TOKEN }}
113+
114+
- name: SonarCloud Scan
115+
if: inputs.run-sonarcloud
116+
uses: SonarSource/sonarqube-scan-action@v6
117+
with:
118+
args: >
119+
-Dsonar.projectKey=${{ inputs.sonar-project-key != '' && inputs.sonar-project-key || format('{0}_{1}', github.repository_owner, github.event.repository.name) }}
120+
-Dsonar.projectVersion=${{ github.run_id }}
121+
env:
122+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
123+
SONAR_TOKEN: ${{ secrets.SONAR_CLOUD_TOKEN }}
124+
LC_ALL: "C.UTF-8"

.github/workflows/frontend-library-pr-release-workflow.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2+
# ⚠️ THIS FILE IS A COPY OF frontend-library-pr-release-workflow-v1.yml
3+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4+
#
5+
# This is the "default" workflow that projects use when they don't specify a version.
6+
# It is intentionally a copy of the latest stable version to avoid delegation complexity.
7+
#
8+
# 📋 Version History:
9+
# - 2026-02-04: Synced from frontend-library-pr-release-workflow-v1.yml (original)
10+
#
11+
# 🔄 To promote a new version to default:
12+
# 1. Copy the new version file content here
13+
# 2. Update the version history above
14+
# 3. Keep the versioned files unchanged for explicit version pinning
15+
#
16+
# 📌 Projects can pin to specific versions:
17+
# - frontend-library-pr-release-workflow-v1.yml (original)
18+
# - frontend-library-pr-release-workflow.yml (this file - currently v1)
19+
#
20+
# 📖 See: ../ci-consolidation/workflow-versioning-strategy.md
21+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
22+
123
name: Library PR & Release Workflow
224

325
on:
@@ -121,4 +143,4 @@ jobs:
121143
env:
122144
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
123145
SONAR_TOKEN: ${{ secrets.SONAR_CLOUD_TOKEN }}
124-
LC_ALL: "C.UTF-8"
146+
LC_ALL: "C.UTF-8"

.github/workflows/frontend-pr-workflow-v2.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
1-
# Version: v2 (base PR workflow)
2-
# Version tracking: See workflow-version output and WORKFLOW_VERSION/WORKFLOW_FILE env vars
31
name: Frontend PR Workflow
42

3+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4+
# 📋 WORKFLOW VERSION CONFIGURATION
5+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
6+
#
7+
# This is the ONLY place you need to update the version number.
8+
# All version references throughout this workflow use these values.
9+
#
10+
# WORKFLOW_VERSION: Short version identifier (v1, v2, v3, etc.)
11+
# WORKFLOW_FILE: Full filename without extension
12+
#
13+
# When creating a new version:
14+
# 1. Copy this file to a new filename (e.g., frontend-pr-workflow-v3.yml)
15+
# 2. Update ONLY these two values below
16+
# 3. Everything else will automatically use the new version
17+
#
18+
env:
19+
WORKFLOW_VERSION: 'v2'
20+
WORKFLOW_FILE: 'frontend-pr-workflow-v2'
21+
#
22+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
23+
524
# This workflow is designed to be called from other repositories
625
# It uses the same branch/tag as the calling workflow for consistency
726

@@ -287,9 +306,9 @@ jobs:
287306
id: artifact-info
288307
run: |
289308
echo "name=build-${{ github.run_id }}" >> $GITHUB_OUTPUT
290-
echo "version=v2" >> $GITHUB_OUTPUT
309+
echo "version=${{ env.WORKFLOW_VERSION }}" >> $GITHUB_OUTPUT
291310
echo "📦 Build artifact: build-${{ github.run_id }}"
292-
echo "📋 Workflow version: v2 (frontend-pr-workflow)"
311+
echo "📋 Workflow version: ${{ env.WORKFLOW_VERSION }} (${{ env.WORKFLOW_FILE }})"
293312
294313
- name: Upload build artifacts
295314
if: ${{ !env.ACT }}
@@ -455,8 +474,8 @@ jobs:
455474
if: inputs.jarvis-datadog-enabled
456475
run: |
457476
npx --yes @datadog/datadog-ci@latest tag --level pipeline \
458-
--tags "workflow_version:v2" \
459-
--tags "workflow_file:frontend-pr-workflow"
477+
--tags "workflow_version:${{ env.WORKFLOW_VERSION }}" \
478+
--tags "workflow_file:${{ env.WORKFLOW_FILE }}"
460479
env:
461480
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
462481
DATADOG_SITE: datadoghq.com

.github/workflows/frontend-pr-workflow.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2+
# ⚠️ THIS FILE IS A COPY OF frontend-pr-workflow-v1.yml
3+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4+
#
5+
# This is the "default" workflow that projects use when they don't specify a version.
6+
# It is intentionally a copy of the latest stable version to avoid delegation complexity.
7+
#
8+
# 📋 Version History:
9+
# - 2026-02-04: Synced from frontend-pr-workflow-v1.yml (original, with Cypress)
10+
#
11+
# 🔄 To promote a new version to default:
12+
# 1. Copy the new version file content here (e.g., from frontend-pr-workflow-v2.yml)
13+
# 2. Update the version history above
14+
# 3. Keep the versioned files unchanged for explicit version pinning
15+
#
16+
# 📌 Projects can pin to specific versions:
17+
# - frontend-pr-workflow-v1.yml (original, with Cypress support)
18+
# - frontend-pr-workflow-v2.yml (enhanced with testing support)
19+
# - frontend-pr-workflow.yml (this file - currently v1)
20+
#
21+
# 📖 See: ../ci-consolidation/workflow-versioning-strategy.md
22+
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
23+
124
name: Frontend PR Workflow
225

326
# This workflow is designed to be called from other repositories
@@ -610,4 +633,4 @@ jobs:
610633
path: |
611634
cypress/screenshots/
612635
cypress/videos/
613-
retention-days: 7
636+
retention-days: 7

0 commit comments

Comments
 (0)