Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed workflow_dispatch runs for docker.yml GHA workflow #752

Merged
merged 10 commits into from
Aug 28, 2024
13 changes: 6 additions & 7 deletions .github/workflows/build-and-push-image.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and push image to GAR
name: Reusable build-and-push workflow

run-name: Build and push image "${{ inputs.image }}:${{ inputs.tag }}" to GAR

Expand All @@ -12,15 +12,15 @@ on:
required: true
type: string
gar_location:
required: true
required: false
type: string
emaydeck-mozilla marked this conversation as resolved.
Show resolved Hide resolved
default: us
gar_repository:
required: true
required: false
type: string
default: autopush-prod
gcp_project_id:
required: true
required: false
type: string
default: moz-fx-autopush-prod
image:
Expand Down Expand Up @@ -57,6 +57,7 @@ jobs:
"${GITHUB_SERVER_URL}" \
"${GITHUB_REPOSITORY}" \
"${GITHUB_RUN_ID}" > version.json
- uses: docker/setup-buildx-action@v3
- id: gcp-auth
uses: google-github-actions/auth@v2
with:
Expand All @@ -73,9 +74,7 @@ jobs:
with:
context: .
file: Dockerfile
tags:
- ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.IMAGE }}:latest
- ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.IMAGE }}:${{ env.TAG }}
tags: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.IMAGE }}:latest,${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.IMAGE }}:${{ env.TAG }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
determine-tag:
name: Determine tag to build
if: |
github.event_name == "workflow_dispatch" ||
(github.event_name == "check_run" && \
github.event.check_run.name == "build-test-deploy" && \
github.event.check_run.conclusion == "success" && \
github.ref_type == "tag")
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'check_run' &&
github.event.check_run.name == 'build-test-deploy' &&
github.event.check_run.conclusion == 'success' &&
github.ref_type == 'tag')
runs-on: ubuntu-latest
permissions: {}
outputs:
Expand All @@ -38,7 +38,7 @@ jobs:

autoconnect:
name: "Autoconnect: Build and push to GAR"
needs: [tag]
needs: [determine-tag]
permissions:
contents: read
id-token: write
Expand All @@ -48,11 +48,11 @@ jobs:
binary: autoconnect
crate: autoconnect
image: autoconnect
tag: ${{ needs.tag.outputs.TAG }}
tag: ${{ needs.determine-tag.outputs.TAG }}

autoendpoint:
name: "Autoendpoint: Build and push to GAR"
needs: [tag]
needs: [determine-tag]
permissions:
contents: read
id-token: write
Expand All @@ -62,4 +62,4 @@ jobs:
binary: autoendpoint
crate: autoendpoint
image: autoendpoint
tag: ${{ needs.tag.outputs.TAG }}
tag: ${{ needs.determine-tag.outputs.TAG }}
Loading