Skip to content

Commit

Permalink
chore: Update build-deploy-production.yml to use github.ref for branc…
Browse files Browse the repository at this point in the history
…h name in build job
  • Loading branch information
wicksipedia committed Apr 29, 2024
1 parent 55d96f3 commit a0592ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
20 changes: 1 addition & 19 deletions .github/workflows/build-deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,17 @@ on:
branches:
- release/*
workflow_dispatch:
inputs:
branch_name:
required: false
type: string
description: 'The branch to build from (defaults to calculating what the latest release/* branch is)'

concurrency:
group: production

jobs:

find-latest-branch:
if: ${{ !inputs.branch_name }}
name: Find latest branch
runs-on: ubuntu-latest
outputs:
branch_name: ${{ steps.find_branch.outputs.branch_name }}
steps:
- uses: actions/checkout@v4
- name: Find latest branch
id: find_branch
run: echo "branch_name=$(git ls-remote --heads origin | grep -oe 'refs/heads/release/.*' | sort -V | tail -n 1 | sed 's|refs/heads/||')" >> $GITHUB_OUTPUT

build:
name: Build
needs: find-latest-branch
uses: ./.github/workflows/template-build.yml
with:
branch_name: ${{ inputs.branch_name || needs.find-latest-branch.outputs.branch_name }}
branch_name: ${{ github.ref }}
environment: production
secrets: inherit

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/template-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,14 @@ jobs:
- name: Install dependencies
run: yarn install --immutable

- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores

- name: Build
run: yarn build
env:
GATSBY_CPU_COUNT: ${{ steps.cpu-cores.outputs.count }}
GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES: true

- name: Archive artifacts
Expand Down

0 comments on commit a0592ad

Please sign in to comment.