Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Commit

Permalink
chore: move commit check into the same job as the build as it seems e…
Browse files Browse the repository at this point in the history
…nv vars do not cross job boundaries (#174)

Signed-off-by: Nick Boldt <nboldt@redhat.com>
  • Loading branch information
nickboldt committed Jan 29, 2024
1 parent af8c68c commit bdb6b63
Showing 1 changed file with 16 additions and 25 deletions.
41 changes: 16 additions & 25 deletions .github/workflows/next-container-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,21 @@ env:
REGISTRY: quay.io

jobs:
check-changes:
# check if the change for this PR necessitates a rebuild of containers
next-build:
name: Next build
runs-on: ubuntu-latest
needs: check-changes
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: check-changes
# check changes in this commit for regex include and exclude matches; pipe to an env var

# check changes in this commit for regex include and exclude matches; pipe to an env var
- name: Check for changes to build
run: |
# don't fail if nothing returned by grep
set +e
Expand All @@ -56,27 +61,6 @@ jobs:
echo EOF
} >> "$GITHUB_ENV"
next-build:
name: Next build
runs-on: ubuntu-latest
needs: check-changes
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Go
# run this stage only if there are changes that match the includes and not the excludes
if: ${{ env.CHANGES != '' }}
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Get the last commit short SHA
# run this stage only if there are changes that match the includes and not the excludes
if: ${{ env.CHANGES != '' }}
Expand All @@ -86,6 +70,13 @@ jobs:
BASE_VERSION=$(grep -E "^VERSION \?=" Makefile | sed -r -e "s/.+= //") # 0.0.1
echo "BASE_VERSION=$BASE_VERSION" >> $GITHUB_ENV
- name: Setup Go
# run this stage only if there are changes that match the includes and not the excludes
if: ${{ env.CHANGES != '' }}
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Login to quay.io
# run this stage only if there are changes that match the includes and not the excludes
if: ${{ env.CHANGES != '' }}
Expand Down

0 comments on commit bdb6b63

Please sign in to comment.