Skip to content

Commit

Permalink
Workflow fixes and changes (#105)
Browse files Browse the repository at this point in the history
- The rolling build is detecting that there is a newer base image
available, but it's not properly triggering the build and publish step.
This change attempts to fix that issue by simplifying the workflow and
properly propagating and checking the output value.
- Updated build job names.
- Added the ability to skip the CI build by specifying "ci skip" in the
commit message.

#ci skip
  • Loading branch information
craigktreasure authored Nov 8, 2023
1 parent e11164d commit a108068
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function CheckLastExitCode($message) {

function PullImage($imageName) {
Write-Host "Pulling image $imageName..." -ForegroundColor Magenta
docker pull $imageName
docker pull $imageName | Out-Host
CheckLastExitCode "Failed to pull image $imageName"
}

Expand Down
5 changes: 3 additions & 2 deletions .github/actions/image-update-check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ inputs:
description: The container base image.
outputs:
needs-updating:
description: Whether the image needs updating.
description: Whether the base image needs updating. Either `true` or `false`.
value: ${{ steps.update-check.outputs.needsBaseUpdate }}

runs:
Expand All @@ -22,4 +22,5 @@ runs:
shell: pwsh
run: |
$imageNeedsUpdate = ${{ github.action_path }}/CheckImageNeedsBaseUpdate.ps1 -Image ${{ inputs.image }} -BaseImage ${{ inputs.base-image }} -CheckDateCreated
"needsBaseUpdate=$imageNeedsUpdate" >> $env:GITHUB_ENV
Write-Host "needsBaseUpdate=$($imageNeedsUpdate.ToString().ToLower())"
"needsBaseUpdate=$($imageNeedsUpdate.ToString().ToLower())" >> $env:GITHUB_OUTPUT
3 changes: 2 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ on:

jobs:
build_ci:
name: Build
name: CI Build
if: "!contains(github.event.head_commit.message, 'ci skip')"
uses: ./.github/workflows/workflow_build.yml
secrets: inherit
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: pull_request

jobs:
build_pr:
name: Build
name: PR Build
uses: ./.github/workflows/workflow_build.yml
secrets: inherit
with:
Expand Down
22 changes: 16 additions & 6 deletions .github/workflows/Rolling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,24 @@ on:

jobs:
check:
name: Container Image Update Check
uses: ./.github/workflows/workflow_image-update-check.yml
with:
base-image: mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0-distroless
image: craigktreasure/synologyddnsupdater:latest
name: Rolling check
runs-on: ubuntu-latest
outputs:
needs-updating: ${{ steps.update-check.outputs.needs-updating }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Container Image Update Check
id: update-check
uses: ./.github/actions/image-update-check
with:
base-image: mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0-distroless
image: craigktreasure/synologyddnsupdater:latest

build_rolling:
name: Build
name: Rolling Build
needs: check
if: needs.check.outputs.needs-updating == 'true'
uses: ./.github/workflows/workflow_build.yml
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/workflow_image-update-check.yml

This file was deleted.

0 comments on commit a108068

Please sign in to comment.