diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 038277b6eb..ff14624b2c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,7 @@ jobs: security-events: write # for github/codeql-action/upload-sarif to upload SARIF results packages: write # for docker/build-push-action to push to GHCR id-token: write # for docker/login to login to NGINX registry - runs-on: ${{ github.event_name != 'pull_request' && contains(inputs.image, 'plus') && 'kic-plus' || 'ubuntu-22.04' }} + runs-on: ${{ github.event_name != 'pull_request' && contains(inputs.image, 'plus') && 'kic-plus' || 'ubuntu-24.04' }} services: registry: image: registry:2 @@ -101,6 +101,7 @@ jobs: id: meta uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 with: + context: ${{ inputs.tag != '' && 'git' || 'workflow' }} images: | name=ghcr.io/nginxinc/nginx-gateway-fabric,enable=${{ inputs.image == 'ngf' && github.event_name != 'pull_request' }} name=ghcr.io/nginxinc/nginx-gateway-fabric/nginx,enable=${{ inputs.image == 'nginx' && github.event_name != 'pull_request' }} diff --git a/.github/workflows/update-docker-images.yml b/.github/workflows/update-docker-images.yml index 48b6fbae14..ba803b5335 100644 --- a/.github/workflows/update-docker-images.yml +++ b/.github/workflows/update-docker-images.yml @@ -3,7 +3,12 @@ name: Update Docker Images on: schedule: - cron: "0 2 * * *" # run every day at 02:00 UTC - workflow_dispatch: # yamllint disable-line rule:empty-values + workflow_dispatch: + inputs: + force-update: + description: 'Force update of images' + required: false + type: boolean defaults: run: @@ -43,7 +48,7 @@ jobs: - name: Set NGINX version id: nginx run: | - version=library/nginx:$(grep -m1 "FROM.*nginx:.*alpine" < build/Dockerfile.nginx | awk -F"[ :]" '{print $3}') + version=$(grep -m1 "FROM.*nginx:.*alpine" < build/Dockerfile.nginx | awk -F" " '{print $2}') echo nginx_version=${version} >> $GITHUB_OUTPUT check: @@ -51,7 +56,7 @@ jobs: runs-on: ubuntu-24.04 needs: variables outputs: - needs-updating: ${{ steps.needs.outputs.needs-updating }} + needs-updating: ${{ steps.update.outputs.needs-updating }} steps: - name: Login to GitHub Container Registry uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 @@ -66,15 +71,11 @@ jobs: with: base-image: ${{ needs.variables.outputs.nginx_version }} image: ghcr.io/nginxinc/nginx-gateway-fabric/nginx:${{ needs.variables.outputs.ngf_tag }} - platforms: "linux/arm64,linux/amd64" - - - id: needs - run: echo "needs-updating=${{ steps.update.outputs.needs-updating }}" >> $GITHUB_OUTPUT build: name: Build Image needs: [variables, check] - if: ${{ needs.check.outputs.needs-updating }} + if: ${{ needs.check.outputs.needs-updating == 'true' || inputs.force-update == true }} uses: ./.github/workflows/build.yml with: image: nginx