Skip to content

Commit 3cd3dab

Browse files
committed
OIDC ctx testing
1 parent 9523af1 commit 3cd3dab

2 files changed

Lines changed: 82 additions & 2 deletions

File tree

.github/workflows/docs-build-push.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ name: Docs Build Push
33
on:
44
workflow_call:
55
secrets:
6-
AZURE_CREDENTIALS:
6+
OIDC_CLIENT_ID:
7+
required: true
8+
OIDC_TENANT_ID:
9+
required: true
10+
OIDC_SUBSCRIPTION_ID:
711
required: true
812
AZURE_KEY_VAULT:
913
required: true
@@ -88,6 +92,8 @@ jobs:
8892
needs: [checks]
8993
if: ${{ needs.checks.outputs.forked_workflow == 'false' }}
9094
runs-on: ubuntu-24.04
95+
permissions:
96+
id-token: write
9197
outputs:
9298
PREVIEW_URL: ${{ steps.summary.outputs.PREVIEW_URL }}
9399
env:
@@ -164,7 +170,9 @@ jobs:
164170
- name: Azure login
165171
uses: azure/login@a65d910e8af852a8061c627c456678983e180302 # v2.2.0
166172
with:
167-
creds: ${{ secrets.AZURE_CREDENTIALS }}
173+
client-id: ${{ secrets.OIDC_CLIENT_ID }}
174+
tenant-id: ${{ secrets.OIDC_TENANT_ID }}
175+
subscription-id: ${{ secrets.OIDC_SUBSCRIPTION_ID }}
168176

169177
- name: Retrieve secrets from Keyvault
170178
id: keyvault
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Docs Build & Deploy (Hugo Only)
2+
on:
3+
workflow_call:
4+
secrets:
5+
OIDC_TENANT_ID:
6+
required: true
7+
OIDC_CLIENT_ID:
8+
required: true
9+
inputs:
10+
NODE_DEPS:
11+
type: boolean
12+
BUILD_ROOT:
13+
type: string
14+
description: Root directory to start a build
15+
default: ./
16+
required: false
17+
outputs:
18+
PREVIEW_URL:
19+
description: String
20+
21+
22+
env:
23+
GO_VERISON: "1.21" # Go version used for `hugo mod get`
24+
HUGO_VERSION: "0.147.8" # Hugo version used for building docs
25+
THEME_MODULE: "github.com/nginxinc/nginx-hugo-theme/v2" # Name of source repo for module. For example; github.com/nginxinc/nginx-hugo-theme
26+
27+
28+
jobs:
29+
checks:
30+
name: Checks and variables
31+
runs-on: ubuntu-24.04
32+
permissions:
33+
contents: read
34+
outputs:
35+
forked_workflow: ${{ steps.vars.outputs.forked_workflow }}
36+
steps:
37+
- name: Checkout Repository
38+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39+
40+
- name: Set Variables
41+
id: vars
42+
run: |
43+
echo "forked_workflow=${{ (github.event.pull_request && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) || !(startsWith(github.repository, 'nginx/') || startsWith(github.repository, 'nginxinc/')) }}" >> $GITHUB_OUTPUT
44+
- name: Output variables
45+
run: |
46+
echo forked_workflow: ${{ steps.vars.outputs.forked_workflow }}
47+
build:
48+
runs-on: ubuntu-24.04
49+
concurrency:
50+
group: ${{ github.workflow }}-${{ github.ref }}
51+
outputs:
52+
PREVIEW_URL: ${{ steps.summary.outputs.PREVIEW_URL }}
53+
steps:
54+
- name: Azure login
55+
uses: azure/login@a65d910e8af852a8061c627c456678983e180302
56+
with:
57+
client-id: ${{ secrets.OIDC_CLIENT_ID }}
58+
tenant-id: ${{ secrets.OIDC_TENANT_ID }}
59+
60+
- name: Checkout docs content
61+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.7.1
62+
with:
63+
fetch-depth: 0 # This is required for hugo Lastmod to function properly
64+
65+
- name: Setup Go
66+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
67+
with:
68+
go-version: ${{ env.GO_VERSION }}
69+
cache: false
70+
71+
- name: Setup Hugo
72+
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3.0.0

0 commit comments

Comments
 (0)