Skip to content

Commit 5ba1bbd

Browse files
committed
Enhance GitHub Actions workflows for conditional image pushing and authentication
- Updated conditions for pushing app and test app images to exclude shared targets. - Added a new step for authenticating to Google Cloud using workload identity and service account secrets. - Introduced a step to retrieve the short SHA for better traceability in the workflow.
1 parent 1d9974c commit 5ba1bbd

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.github/workflows/_build-app.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
make ${{ inputs.make_target_prefix }}build.app
5252
5353
- name: Push app
54-
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
54+
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' && inputs.make_target_prefix != 'shared.' }}
5555
run: |
5656
make ${{ inputs.make_target_prefix }}push.app-temp
5757
@@ -85,6 +85,6 @@ jobs:
8585
make ${{ inputs.make_target_prefix }}build.test-app
8686
8787
- name: Push Test App
88-
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
88+
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' && inputs.make_target_prefix != 'shared.' }}
8989
run: |
9090
make ${{ inputs.make_target_prefix }}push.test-app-temp

.github/workflows/_push-env.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,21 @@ jobs:
4646
with:
4747
fetch-depth: 0
4848
submodules: 'recursive'
49+
4950
- name: Get Release SHA
5051
env:
5152
SHA: ${{ github.sha }}
5253
id: sha
5354
run: echo short_sha="${SHA:0:7}" >> $GITHUB_OUTPUT
55+
56+
- id: "auth"
57+
name: "Authenticate to Google Cloud"
58+
uses: "google-github-actions/[email protected]"
59+
with:
60+
token_format: "access_token"
61+
workload_identity_provider: ${{ secrets.CODECOV_GCP_WIDP }}
62+
service_account: ${{ secrets.CODECOV_GCP_WIDSA }}
63+
5464
- name: Pull built image
5565
run: |
5666
make ${{ inputs.make_target_prefix }}pull.app-temp

0 commit comments

Comments
 (0)