Skip to content

Commit 55b67db

Browse files
authored
Merge branch 'develop' into feature/new-piv-keys-2
2 parents acee9d4 + 2b9328d commit 55b67db

File tree

234 files changed

+713
-299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

234 files changed

+713
-299
lines changed

.github/scripts/commit-and-push.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if [[ -z "${GITOPS_BRANCH:-}" ]]; then
5+
echo "GITOPS_BRANCH must be set."
6+
exit 1
7+
fi
8+
9+
if [[ -z "${IMAGE_TAG:-}" ]]; then
10+
echo "IMAGE_TAG must be set."
11+
exit 1
12+
fi
13+
14+
kustomization_path="k8s/yesdk/kustomization.yaml"
15+
16+
commit_msg=$(
17+
cat <<EOF
18+
Update $kustomization_path
19+
20+
Using image tag $IMAGE_TAG
21+
22+
Triggered by workflow: https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}
23+
Triggered by actor: ${GITHUB_ACTOR}
24+
EOF
25+
)
26+
27+
if git diff --exit-code --quiet; then
28+
echo "Nothing to commit. Skipped git commit/push."
29+
exit 0
30+
fi
31+
32+
git add "$kustomization_path"
33+
git commit --message "$commit_msg"
34+
35+
max_retries=10
36+
retry_count=0
37+
while [ $retry_count -lt $max_retries ]; do
38+
git fetch origin "$GITOPS_BRANCH"
39+
git rebase "origin/$GITOPS_BRANCH"
40+
41+
if git push; then
42+
echo "Push successful"
43+
break
44+
else
45+
((retry_count += 1))
46+
if [ $retry_count -ge $max_retries ]; then
47+
echo "Max retries reached. Exiting with failure."
48+
exit 1
49+
fi
50+
51+
echo "Failed to push. Retrying..."
52+
sleep 5
53+
fi
54+
done

.github/scripts/configure-git-pgp.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if [[ -z "${PGP_KEY:-}" ]]; then
5+
echo "PGP_KEY must be set."
6+
exit 1
7+
fi
8+
9+
echo "$PGP_KEY" | gpg --import
10+
11+
key_id=$(gpg --list-secret-keys --with-colons | awk -F: '$1 == "sec" {print $5}')
12+
git config --global commit.gpgsign "true"
13+
git config --global user.signingKey "${key_id}"
14+
echo "Using PGP key for git commit signing: ${key_id}"
15+
16+
pgp_user_id=$(gpg --list-keys --with-colons "$key_id" | awk -F: '$1 == "uid" {print $10}')
17+
pgp_name=$(echo "$pgp_user_id" | cut --delimiter '<' --fields 1)
18+
pgp_email=$(echo "$pgp_user_id" | cut --delimiter '<' --fields 2 | cut --delimiter '>' --fields 1)
19+
git config --global user.name "${pgp_name}"
20+
git config --global user.email "${pgp_email}"
21+
22+
echo "Git name: ${pgp_name}"
23+
echo "Git email: ${pgp_email}"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if [[ -z "${GITHUB_TOKEN:-}" ]]; then
5+
echo "GITHUB_TOKEN must be set."
6+
exit 1
7+
fi
8+
9+
if [[ -z "${REF:-}" ]]; then
10+
echo "REF must be set."
11+
exit 1
12+
fi
13+
14+
ORG=${ORG:-Yubico}
15+
REPO=${REPO:-docs-gitops}
16+
KUSTOMIZATION_NAME=${KUSTOMIZATION_NAME:-docs}
17+
18+
timeout_minutes=15
19+
end_time=$(date -ud "+$timeout_minutes minutes" +%s)
20+
21+
echo "Looking for status:"
22+
echo " Repo: $ORG/$REPO"
23+
echo " Ref: $REF"
24+
echo " Status context: kustomization/$KUSTOMIZATION_NAME"
25+
echo
26+
27+
state=""
28+
message_printed=false
29+
while [[ -z "$state" ]]; do
30+
state=$(gh api "/repos/$ORG/$REPO/commits/$REF/status" | jq -r ".statuses[] | select(.context | startswith(\"kustomization/$KUSTOMIZATION_NAME/\")).state")
31+
32+
if [[ -n "$state" ]]; then
33+
echo "Status: $state"
34+
break
35+
fi
36+
37+
if [[ $(date -u +%s) -ge $end_time ]]; then
38+
echo "Deployment was not complete after $timeout_minutes minutes."
39+
exit 1
40+
fi
41+
42+
if [[ "$message_printed" == "false" ]]; then
43+
echo "Waiting for deployment to complete (timeout: $timeout_minutes minutes)..."
44+
message_printed=true
45+
fi
46+
sleep 10
47+
done
48+
49+
if [[ "$state" != "success" ]]; then
50+
exit 1
51+
fi
52+
53+
exit 0

.github/workflows/build-pull-requests.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,20 @@ jobs:
5656
run: dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Yubico/index.json"
5757

5858
- name: Build Yubico.NET.SDK.sln
59-
run: dotnet build --configuration ReleaseWithDocs --nologo --verbosity minimal Yubico.NET.SDK.sln
59+
run: dotnet build --configuration Release --nologo --verbosity minimal Yubico.NET.SDK.sln
6060

6161
- name: Save build artifacts
6262
uses: actions/upload-artifact@v4
6363
with:
64-
name: Nuget Packages ReleaseWithDocs
64+
name: Nuget Packages Release
6565
path: |
66-
Yubico.Core/src/bin/ReleaseWithDocs/*.nupkg
67-
Yubico.YubiKey/src/bin/ReleaseWithDocs/*.nupkg
66+
Yubico.Core/src/bin/Release/*.nupkg
67+
Yubico.YubiKey/src/bin/Release/*.nupkg
6868
6969
- name: Save build artifacts
7070
uses: actions/upload-artifact@v4
7171
with:
72-
name: Assemblies ReleaseWithDocs
72+
name: Assemblies Release
7373
path: |
74-
Yubico.Core/src/bin/ReleaseWithDocs/**/*.dll
75-
Yubico.YubiKey/src/bin/ReleaseWithDocs/**/*.dll
74+
Yubico.Core/src/bin/Release/**/*.dll
75+
Yubico.YubiKey/src/bin/Release/**/*.dll

.github/workflows/build.yml

Lines changed: 51 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ on:
3535
required: false
3636
default: false
3737
type: boolean
38+
push-to-docs:
39+
description: 'Push docs to internal GCP'
40+
required: false
41+
default: false
42+
type: boolean
3843
version:
3944
description: 'Version'
4045
required: false
@@ -43,8 +48,6 @@ on:
4348
schedule:
4449
- cron: '0 0 * * *' # Every day at midnight
4550

46-
47-
4851
jobs:
4952
run-tests:
5053
name: Run tests
@@ -86,71 +89,75 @@ jobs:
8689
8790
# Build the project
8891
- name: Build Yubico.NET.SDK.sln
89-
run: dotnet build --configuration ReleaseWithDocs --nologo --verbosity minimal Yubico.NET.SDK.sln
92+
run: dotnet pack --configuration Release --nologo --verbosity minimal Yubico.NET.SDK.sln
93+
94+
# Build the documentation
95+
- name: Build docs
96+
run: |
97+
dotnet tool install --global docfx --version "2.*"
98+
docfx docfx.json --logLevel warning --log docfx.log --warningsAsErrors
9099
91-
# Upload artifacts
92-
- name: Save documentation artifacts
100+
# Upload documentation log
101+
- name: "Save build artifacts: Docs log"
93102
uses: actions/upload-artifact@v4
94103
with:
95-
name: Documentation
96-
path: Yubico.YubiKey/docs/_site/
104+
name: Documentation log
105+
path: docfx.log
106+
if-no-files-found: error
97107

98-
- name: Save build artifacts
108+
# Upload documentation
109+
- name: "Save build artifacts: Docs"
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: Documentation
113+
path: docs/_site/
114+
if-no-files-found: error
115+
116+
# Upload NuGet packages
117+
- name: "Save build artifacts: Nuget Packages"
99118
uses: actions/upload-artifact@v4
100119
with:
101120
name: Nuget Packages
102121
path: |
103-
Yubico.Core/src/bin/ReleaseWithDocs/*.nupkg
104-
Yubico.YubiKey/src/bin/ReleaseWithDocs/*.nupkg
122+
Yubico.Core/src/bin/Release/*.nupkg
123+
Yubico.YubiKey/src/bin/Release/*.nupkg
124+
if-no-files-found: error
105125

106-
- name: Save build artifacts
126+
# Upload symbols
127+
- name: "Save build artifacts: Symbols Packages"
107128
uses: actions/upload-artifact@v4
108129
with:
109130
name: Symbols Packages
110131
path: |
111-
Yubico.Core/src/bin/ReleaseWithDocs/*.snupkg
112-
Yubico.YubiKey/src/bin/ReleaseWithDocs/*.snupkg
113-
114-
- name: Save build artifacts
132+
Yubico.Core/src/bin/Release/*.snupkg
133+
Yubico.YubiKey/src/bin/Release/*.snupkg
134+
if-no-files-found: error
135+
136+
# Upload assemblies
137+
- name: "Save build artifacts: Assemblies"
115138
uses: actions/upload-artifact@v4
116139
with:
117140
name: Assemblies
118141
path: |
119-
Yubico.Core/src/bin/ReleaseWithDocs/**/*.dll
120-
Yubico.YubiKey/src/bin/ReleaseWithDocs/**/*.dll
121-
142+
Yubico.Core/src/bin/Release/**/*.dll
143+
Yubico.YubiKey/src/bin/Release/**/*.dll
144+
if-no-files-found: error
145+
146+
# Generate artifact attestation
122147
- name: Generate artifact attestation
123148
uses: actions/attest-build-provenance@v2
124149
with:
125150
subject-path: |
126-
Yubico.Core/src/bin/ReleaseWithDocs/*.nupkg
127-
Yubico.YubiKey/src/bin/ReleaseWithDocs/*.nupkg
128-
Yubico.Core/src/bin/ReleaseWithDocs/*.snupkg
129-
Yubico.YubiKey/src/bin/ReleaseWithDocs/*.snupkg
130-
Yubico.Core/src/bin/ReleaseWithDocs/**/*.dll
131-
Yubico.YubiKey/src/bin/ReleaseWithDocs/**/*.dll
132-
133-
# Package the OATH sample code source
134-
- name: Save build artifacts
135-
uses: actions/upload-artifact@v4
136-
with:
137-
name: OATH Sample Code
138-
path: |
139-
Yubico.YubiKey/examples/OathSampleCode
140-
Yubico.YubiKey/examples/SharedSampleCode
141-
142-
# Package the PIV sample code source
143-
- name: Save build artifacts
144-
uses: actions/upload-artifact@v4
145-
with:
146-
name: PIV Sample Code
147-
path: |
148-
Yubico.YubiKey/examples/PivSampleCode
149-
Yubico.YubiKey/examples/SharedSampleCode
151+
Yubico.Core/src/bin/Release/*.nupkg
152+
Yubico.YubiKey/src/bin/Release/*.nupkg
153+
Yubico.Core/src/bin/Release/*.snupkg
154+
Yubico.YubiKey/src/bin/Release/*.snupkg
155+
Yubico.Core/src/bin/Release/**/*.dll
156+
Yubico.YubiKey/src/bin/Release/**/*.dll
150157
151158
upload-docs:
152159
name: Upload docs
153-
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
160+
if: ${{ github.event.inputs.push-to-docs == 'true' }}
154161
permissions:
155162
id-token: write
156163
contents: read
@@ -161,7 +168,7 @@ jobs:
161168
name: Publish to internal NuGet
162169
runs-on: windows-2019
163170
needs: build-artifacts
164-
if: ${{ github.event.inputs.push-to-dev }}
171+
if: ${{ github.event.inputs.push-to-dev == 'true' }}
165172
permissions:
166173
contents: read
167174
packages: write

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
run: dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Yubico/index.json"
6969

7070
- name: Build Yubico.NET.SDK.sln
71-
run: dotnet build --configuration Release --nologo --verbosity normal Yubico.NET.SDK.sln
71+
run: dotnet build --configuration Release --nologo --verbosity minimal Yubico.NET.SDK.sln
7272

7373
- name: Perform CodeQL Analysis
7474
uses: github/codeql-action/analyze@v3

0 commit comments

Comments
 (0)