Skip to content

Commit c9fc3de

Browse files
authored
enhance(stage-build): always build from next + trigger from main (#10986)
* chore(stage-build): remove misleading ref input * enhance(stage-build): always trigger on main + build on next
1 parent 1093f7a commit c9fc3de

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

Diff for: .github/workflows/stage-build.yml

+6-13
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ env:
1313
DEFAULT_DEPLOYMENT_PREFIX: "main"
1414
DEFAULT_NOTES: ""
1515
DEFAULT_LOG_EACH_SUCCESSFUL_UPLOAD: "false"
16-
DEFAULT_REF: next
1716

1817
on:
1918
schedule:
@@ -22,10 +21,6 @@ on:
2221

2322
workflow_dispatch:
2423
inputs:
25-
ref:
26-
description: "Branch to deploy (default: next)"
27-
required: false
28-
2924
notes:
3025
description: "Notes"
3126
required: false
@@ -67,19 +62,20 @@ permissions:
6762
jobs:
6863
trigger:
6964
runs-on: ubuntu-latest
70-
if: ${{ github.repository == 'mdn/yari' && github.event.schedule != '' }}
65+
66+
# When run from `main` branch (schedule or manual), trigger workflow on `next` branch instead.
67+
if: ${{ github.repository == 'mdn/yari' && github.ref_name == 'main' }}
7168
steps:
72-
# The schedule runs the `main` version, but we want the `next` version.
73-
- run: gh workflow run "${{ github.workflow }}" --repo "${{ github.repository }}" --ref "${{ env.DEFAULT_REF }}"
69+
- run: gh workflow run "${{ github.workflow }}" --repo "${{ github.repository }}" --ref "next"
7470
env:
7571
GH_TOKEN: ${{ secrets.AUTOMERGE_TOKEN }}
7672

7773
build:
7874
environment: stage
7975
runs-on: ubuntu-latest
8076

81-
# Only run the scheduled workflows on the main repo.
82-
if: ${{ github.repository == 'mdn/yari' && github.event.schedule == '' }}
77+
# We only ever want to deploy the `next` branch to stage.
78+
if: ${{ github.repository == 'mdn/yari' && github.ref_name == 'next' }}
8379

8480
steps:
8581
# Our usecase is a bit complicated. When the cron schedule runs this workflow,
@@ -93,15 +89,12 @@ jobs:
9389
run: |
9490
echo "DEPLOYER_BUCKET_PREFIX=${{ github.event.inputs.deployment_prefix || env.DEFAULT_DEPLOYMENT_PREFIX }}" >> $GITHUB_ENV
9591
echo "DEPLOYER_LOG_EACH_SUCCESSFUL_UPLOAD=${{ github.event.inputs.log_each_successful_upload || env.DEFAULT_LOG_EACH_SUCCESSFUL_UPLOAD }}" >> $GITHUB_ENV
96-
echo "REF=${{ github.event.inputs.ref || env.DEFAULT_REF }}" >> $GITHUB_ENV
9792
9893
- uses: actions/checkout@v4
9994
with:
100-
ref: ${{ env.REF }}
10195
fetch-depth: 0
10296

10397
- name: Merge main
104-
if: ${{ env.REF != 'main' }}
10598
run: |
10699
git config --global user.email "[email protected]"
107100
git config --global user.name "mdn-bot"

0 commit comments

Comments
 (0)