0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Passed along branch name to canary job

ref https://linear.app/tryghost/issue/DEV-20/faster-builds

- we should pass along the branch name in the metadata field so it's
  more DRY for canary builds in the future
This commit is contained in:
Daniel Lockyer 2024-09-23 17:14:57 +02:00 committed by Daniel Lockyer
parent 4dc4b19b09
commit 24447f438e

View file

@ -47,6 +47,10 @@ jobs:
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
- name: Get branch name
id: branch_name
run: echo "BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_OUTPUT
- name: Get metadata (push)
if: github.event_name == 'push'
run: |
@ -179,6 +183,7 @@ jobs:
changed_any_code: ${{ steps.changed.outputs.any-code }}
changed_new_package: ${{ steps.added.outputs.new-package }}
base_commit: ${{ env.BASE_COMMIT }}
branch_name: ${{ steps.branch_name.outputs.BRANCH_NAME }}
is_canary_branch: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/arch') }}
is_main: ${{ env.IS_MAIN }}
has_browser_tests_label: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'browser-tests') }}
@ -949,15 +954,11 @@ jobs:
]
name: Canary
runs-on: ubuntu-latest
if: always() && needs.job_setup.outputs.is_canary_branch == 'true' && needs.job_setup.result == 'success' && needs.job_setup.result == 'success'
if: always() && needs.job_setup.outputs.is_canary_branch == 'true' && needs.job_setup.result == 'success'
steps:
- name: Output needs (for debugging)
run: echo "${{ toJson(needs) }}"
- name: Set env variables
run: |
echo "CANARY_BUILD_INPUTS={\"version\":\"canary\",\"environment\":\"staging\"}" >> $GITHUB_ENV
- name: Invoke build
uses: aurelien-baudet/workflow-dispatch@v2
with:
@ -965,6 +966,6 @@ jobs:
workflow: .github/workflows/deploy.yml
ref: 'refs/heads/main'
repo: TryGhost/Ghost-Moya
inputs: ${{ env.CANARY_BUILD_INPUTS }}
inputs: '{"version":"canary","environment":"staging","version_extra":"${{ needs.job_setup.outputs.branch_name }}"}'
wait-for-completion-timeout: 25m
wait-for-completion-interval: 30s