File tree Expand file tree Collapse file tree 3 files changed +38
-14
lines changed
Expand file tree Collapse file tree 3 files changed +38
-14
lines changed Original file line number Diff line number Diff line change 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"
2423
2524concurrency :
2625 group : build-${{ inputs.environment }}
27- cancel-in-progress : false
2826
2927jobs :
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
Original file line number Diff line number Diff line change 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
1222jobs :
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 }}
Original file line number Diff line number Diff line change 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
1722jobs :
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 }}
You can’t perform that action at this time.
0 commit comments