Skip to content

Commit 8f84a0d

Browse files
committed
chore(workflows): sync build workflows with rumba
Applies all fixes from the rumba workflows.
1 parent d537079 commit 8f84a0d

File tree

3 files changed

+38
-14
lines changed

3 files changed

+38
-14
lines changed

.github/workflows/_build.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ on:
1111
ref:
1212
description: "Branch to build (default: main)"
1313
type: string
14-
default: main
1514

1615
tag:
1716
description: "Additional tag for the Docker image"
@@ -24,11 +23,10 @@ env:
2423

2524
concurrency:
2625
group: build-${{ inputs.environment }}
27-
cancel-in-progress: false
2826

2927
jobs:
3028
docker-build-push:
31-
environment: ${{ inputs.environment }}
29+
environment: build
3230
runs-on: ubuntu-latest
3331

3432
permissions:
@@ -40,10 +38,21 @@ jobs:
4038
id-token: write
4139

4240
steps:
43-
- name: Checkout (rumba)
41+
- name: Validate tag format
42+
if: inputs.tag
43+
env:
44+
TAG: ${{ inputs.tag }}
45+
run: |
46+
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
47+
echo "❌ Invalid tag: $TAG does not match format vX.Y.Z (e.g., v1.2.3)"
48+
exit 1
49+
fi
50+
echo "✅ Valid tag: $TAG"
51+
52+
- name: Checkout
4453
uses: actions/checkout@v4
4554
with:
46-
ref: ${{ inputs.ref }}
55+
ref: ${{ inputs.ref || github.event.repository.default_branch }}
4756

4857
- name: Docker setup
4958
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1

.github/workflows/prod-build.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,25 @@ on:
66
- "v*"
77

88
workflow_dispatch:
9+
inputs:
10+
tag:
11+
description: "Tag to build (e.g. v1.13.0)"
12+
required: true
913

10-
permissions: {}
14+
permissions:
15+
# Read/write GHA cache.
16+
actions: write
17+
# Checkout.
18+
contents: read
19+
# Authenticate with GCP.
20+
id-token: write
1121

1222
jobs:
1323
build:
14-
if: github.repository_owner == 'mdn' && github.ref_protected
24+
if: github.repository_owner == 'mdn'
1525
uses: ./.github/workflows/_build.yml
1626
secrets: inherit
1727
with:
18-
environment: production
19-
ref: ${{ github.ref }}
20-
tag: ${{ github.ref_name }}
28+
environment: prod
29+
ref: ${{ inputs.tag || github.ref }}
30+
tag: ${{ inputs.tag || github.ref_name }}

.github/workflows/stage-build.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,20 @@ on:
1010
ref:
1111
description: "Branch to build (default: main)"
1212
required: false
13-
default: refs/heads/main
1413

15-
permissions: {}
14+
permissions:
15+
# Read/write GHA cache.
16+
actions: write
17+
# Checkout.
18+
contents: read
19+
# Authenticate with GCP.
20+
id-token: write
1621

1722
jobs:
1823
build:
1924
if: github.repository_owner == 'mdn' && github.actor != 'dependabot[bot]'
2025
uses: ./.github/workflows/_build.yml
2126
secrets: inherit
2227
with:
23-
environment: staging
24-
ref: ${{ inputs.ref }}
28+
environment: stage
29+
ref: ${{ inputs.ref || github.event.repository.default_branch }}

0 commit comments

Comments
 (0)