Skip to content

Commit a336024

Browse files
committed
consolidate vars
1 parent 5d1b97b commit a336024

File tree

2 files changed

+17
-25
lines changed

2 files changed

+17
-25
lines changed

.github/workflows/build-and-publish.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,7 @@ jobs:
133133
upload-docs:
134134
name: Upload docs
135135
uses: ./.github/workflows/upload-docs.yml
136-
#if: ${{ github.event.inputs.upload-docs == 'true' }}
137-
with:
138-
image_tag: 'yesdk-docserver'
139-
registry_url: 'us-docker.pkg.dev'
140-
project_id: 'support-cluster-769001'
141-
repository_name: 'yesdk'
136+
#if: ${{ github.event.inputs.upload-docs == 'true' }}
142137
needs: build
143138

144139
publish-internal:

.github/workflows/upload-docs.yml

+16-19
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,17 @@ name: Upload documentation to GCP
1616

1717
on:
1818
workflow_call:
19-
inputs:
20-
image_tag:
21-
required: true
22-
type: string
23-
registry_url:
24-
required: true
25-
type: string
26-
project_id:
27-
required: true
28-
type: string
29-
repository_name:
30-
required: true
31-
type: string
32-
19+
3320
permissions:
3421
id-token: write
22+
contents: read
23+
24+
env:
25+
image_tag: 'yesdk-docserver'
26+
registry_url: 'us-docker.pkg.dev'
27+
project_id: 'support-cluster-769001'
28+
repository_name: 'yesdk'
29+
service_account: [email protected]
3530

3631
jobs:
3732
upload_docs:
@@ -44,14 +39,16 @@ jobs:
4439
path: Yubico.YubiKey/docs/_site/
4540
- name: Build nginx image for documentation
4641
run: |
47-
docker build -t "${{ inputs.image_tag }}:${{ github.sha }}" .
42+
docker build -t "${{ env.image_tag }}:${{ github.sha }}" .
43+
4844
- name: Authenticate to GCP
4945
uses: google-github-actions/auth@v2
5046
with:
5147
workload_identity_provider: ${{ vars.GLOBAL_GCP_WORKLOAD_IDENTITY_PROVIDER }} # Provided at organizational level
52-
service_account: [email protected]
48+
service_account: $${{ env.service_account }}
5349
- name: Push Docker image to GCP
5450
run: |
55-
gcloud auth configure-docker ${{ inputs.registry_url }} --project ${{ inputs.project_id }}
56-
docker tag "${{ inputs.image_tag }}:${{ github.sha }}" "${{ inputs.registry_url }}/${{ inputs.project_id }}/${{ inputs.repository_name }}/${{ inputs.image_tag }}:${{ github.sha }}"
57-
docker push "${{ inputs.registry_url }}/${{ inputs.project_id }}/${{ inputs.repository_name }}/${{ inputs.image_tag }}:${{ github.sha }}"
51+
gcloud auth configure-docker ${{ env.registry_url }} --project ${{ env.project_id }}
52+
docker tag "${{ env.image_tag }}:${{ github.sha }}" "${{ env.registry_url }}/${{ env.project_id }}/${{ env.repository_name }}/${{ env.image_tag }}:${{ github.sha }}"
53+
docker push "${{ env.registry_url }}/${{ env.project_id }}/${{ env.repository_name }}/${{ env.image_tag }}:${{ github.sha }}"
54+
echo "New image tag: ${{ github.sha }}"

0 commit comments

Comments
 (0)