Skip to content

Commit 6bcdb46

Browse files
authored
fix(prod-build): remove ref_protected requirement, add tag input (#639)
* fix(prod-build): remove ref_type/protected requirement It appears `ref_protected` is only true if tag creation is protected, which prevents github-actions from tagging. * chore(prod-build): add tag input Allows building a tag with the current workflow, as triggering the workflow on the tag would run the workflow with the ref_protected issue. * chore(build): validate tag name
1 parent 80621e5 commit 6bcdb46

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

.github/workflows/_build.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ jobs:
3838
id-token: write
3939

4040
steps:
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+
4152
- name: Checkout
4253
uses: actions/checkout@v4
4354
with:

.github/workflows/prod-build.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ 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

1014
permissions:
1115
# Read/write GHA cache.
@@ -17,10 +21,10 @@ permissions:
1721

1822
jobs:
1923
build:
20-
if: github.repository_owner == 'mdn' && github.ref_type == 'tag' && github.ref_protected
24+
if: github.repository_owner == 'mdn'
2125
uses: ./.github/workflows/_build.yml
2226
secrets: inherit
2327
with:
2428
environment: prod
25-
ref: ${{ github.ref }}
26-
tag: ${{ github.ref_name }}
29+
ref: ${{ inputs.tag || github.ref }}
30+
tag: ${{ inputs.tag || github.ref_name }}

0 commit comments

Comments
 (0)