Skip to content

Commit 15bc86f

Browse files
committed
Configure publish pipelines
1 parent b3bfc2d commit 15bc86f

File tree

5 files changed

+80
-61
lines changed

5 files changed

+80
-61
lines changed

.github/actions/nuget-publish/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ runs:
3434
shell: pwsh
3535
run: |
3636
foreach($file in (Get-ChildItem "${{ inputs.nuget-directory }}" -Recurse -Include *.nupkg)) {
37-
echo "dotnet nuget push $file --api-key '${{ inputs.nuget-token }}' --source https://api.nuget.org/v3/index.json --skip-duplicate"
37+
dotnet nuget push $file --api-key "${{ inputs.nuget-token }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
3838
}

.github/actions/rl-scanner/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ runs:
2222
pip install boto3 requests
2323
2424
- name: Configure AWS credentials
25-
uses: aws-actions/configure-aws-credentials@e3dd6a0127b5990325885467db925520ab1e5dd4
25+
uses: aws-actions/configure-aws-credentials@v1
2626
with:
2727
role-to-assume: ${{ env.PRODSEC_TOOLS_ARN }}
2828
aws-region: us-east-1

.github/workflows/nuget-release.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ name: Create NuGet and GitHub Release
33
on:
44
workflow_call:
55
inputs:
6-
nuget-directory:
6+
dotnet-version:
7+
required: true
8+
type: string
9+
project-paths:
710
required: true
811
type: string
912
secrets:
@@ -24,13 +27,6 @@ jobs:
2427
with:
2528
fetch-depth: 0
2629

27-
# Download the NuGet package artifact
28-
- name: Download NuGet package
29-
uses: actions/download-artifact@v4
30-
with:
31-
name: nuget-package
32-
path: ${{ github.workspace }}/${{ inputs.nuget-directory }}
33-
3430
# Get the version from the branch name
3531
- id: get_version
3632
uses: ./.github/actions/get-version
@@ -61,13 +57,14 @@ jobs:
6157
- if: steps.tag_exists.outputs.exists == 'true'
6258
run: exit 1
6359

64-
# Publish the NuGet packages
65-
- name: Publish NuGet packages
66-
shell: pwsh
67-
run: |
68-
foreach($file in (Get-ChildItem "${{ github.workspace }}/${{ inputs.nuget-directory }}" -Recurse -Include *.nupkg)) {
69-
dotnet nuget push $file --api-key "${{ secrets.nuget-token }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
70-
}
60+
# Publish the release to our package manager
61+
- uses: ./.github/actions/nuget-publish
62+
with:
63+
dotnet-version: ${{ inputs.dotnet-version }}
64+
project-paths: ${{ inputs.project-paths }}
65+
version: ${{ steps.get_version.outputs.version }}
66+
nuget-token: ${{ secrets.nuget-token }}
67+
nuget-directory: ${{ github.workspace}}/nuget
7168

7269
# Create a release for the tag
7370
- uses: ./.github/actions/release-create

.github/workflows/release.yml

Lines changed: 53 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,35 @@ permissions:
1313
id-token: write
1414

1515
jobs:
16-
pack:
16+
rl-scanner-aspnetcore-api:
17+
uses: ./.github/workflows/rl-secure.yml
18+
with:
19+
project-path: "src/Auth0.AspNetCore.Authentication.Api/Auth0.AspNetCore.Authentication.Api.csproj"
20+
artifact-name: "Auth0.AspNetCore.Authentication.Api.tgz"
21+
secrets:
22+
RLSECURE_LICENSE: ${{ secrets.RLSECURE_LICENSE }}
23+
RLSECURE_SITE_KEY: ${{ secrets.RLSECURE_SITE_KEY }}
24+
SIGNAL_HANDLER_TOKEN: ${{ secrets.SIGNAL_HANDLER_TOKEN }}
25+
PRODSEC_TOOLS_USER: ${{ secrets.PRODSEC_TOOLS_USER }}
26+
PRODSEC_TOOLS_TOKEN: ${{ secrets.PRODSEC_TOOLS_TOKEN }}
27+
PRODSEC_TOOLS_ARN: ${{ secrets.PRODSEC_TOOLS_ARN }}
28+
29+
release:
30+
needs: [rl-scanner-aspnetcore-api]
31+
uses: ./.github/workflows/nuget-release.yml
32+
with:
33+
dotnet-version: 8.0.x
34+
project-paths: "['src/Auth0.AspNetCore.Authentication.Api/Auth0.AspNetCore.Authentication.Api.csproj']"
35+
secrets:
36+
nuget-token: ${{ secrets.NUGET_APIKEY }}
37+
github-token: ${{ secrets.GITHUB_TOKEN }}
38+
39+
generate-docs:
40+
name: Generate API docs
41+
needs: [release]
1742
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/'))
1843
runs-on: ubuntu-latest
44+
1945
steps:
2046
- name: Checkout code
2147
uses: actions/checkout@v5
@@ -26,44 +52,33 @@ jobs:
2652
uses: actions/setup-dotnet@v5
2753
with:
2854
dotnet-version: 8.0.x
29-
30-
- name: Get version
31-
id: get_version
32-
uses: ./.github/actions/get-version
33-
34-
- name: Create NuGet package
35-
run: |
36-
dotnet pack src/Auth0.AspNetCore.Authentication.Api/Auth0.AspNetCore.Authentication.Api.csproj \
37-
--configuration Release \
38-
--output ${{ github.workspace }}/nuget \
39-
/p:Version=${{ steps.get_version.outputs.version }}
40-
41-
- name: Upload NuGet package as artifact
42-
uses: actions/upload-artifact@v4
55+
56+
- name: Install DocFX
57+
run: dotnet tool install -g docfx
58+
59+
- name: Build docs
60+
run: docfx docs-source/docfx.json
61+
62+
- name: Uploading Artifacts
63+
uses: actions/upload-pages-artifact@v4
4364
with:
44-
name: nuget-package
45-
path: ${{ github.workspace }}/nuget/*.nupkg
46-
retention-days: 1
65+
path: docs
4766

48-
rl-scanner:
49-
needs: pack
50-
uses: ./.github/workflows/rl-secure.yml
51-
with:
52-
artifact-name: "aspnetcore-api.tgz"
53-
secrets:
54-
RLSECURE_LICENSE: ${{ secrets.RLSECURE_LICENSE }}
55-
RLSECURE_SITE_KEY: ${{ secrets.RLSECURE_SITE_KEY }}
56-
SIGNAL_HANDLER_TOKEN: ${{ secrets.SIGNAL_HANDLER_TOKEN }}
57-
PRODSEC_TOOLS_USER: ${{ secrets.PRODSEC_TOOLS_USER }}
58-
PRODSEC_TOOLS_TOKEN: ${{ secrets.PRODSEC_TOOLS_TOKEN }}
59-
PRODSEC_TOOLS_ARN: ${{ secrets.PRODSEC_TOOLS_ARN }}
67+
deploy-docs:
68+
needs: generate-docs
69+
name: Deploy API docs
70+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/'))
6071

72+
permissions:
73+
pages: write # to deploy to Pages
74+
id-token: write # to verify the deployment originates from an appropriate source
6175

62-
release:
63-
needs: rl-scanner
64-
uses: ./.github/workflows/nuget-release.yml
65-
with:
66-
nuget-directory: nuget
67-
secrets:
68-
nuget-token: ${{ secrets.NUGET_APIKEY }}
69-
github-token: ${{ secrets.GITHUB_TOKEN }}
76+
environment:
77+
name: github-pages
78+
url: ${{ steps.deployment.outputs.page_url }}
79+
80+
runs-on: ubuntu-latest
81+
steps:
82+
- name: Deploy to GitHub Pages
83+
id: deployment
84+
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action

.github/workflows/rl-secure.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ run-name: rl-scanner
44
on:
55
workflow_call:
66
inputs:
7+
project-path:
8+
type: string
9+
required: true
710
artifact-name:
811
type: string
912
required: true
@@ -35,16 +38,20 @@ jobs:
3538
with:
3639
fetch-depth: 0
3740

38-
- name: Download NuGet package
39-
uses: actions/download-artifact@v4
41+
- name: Setup .NET
42+
uses: actions/setup-dotnet@v5
4043
with:
41-
name: nuget-package
42-
path: ${{ github.workspace }}/nuget
44+
dotnet-version: 8.0.x
4345

46+
- name: Create NuGet packages
47+
shell: pwsh
48+
run: |
49+
dotnet pack ${{ inputs.project-path }} --configuration Release --output ${{ github.workspace }}/nuget
50+
4451
- name: Create tgz build artifact
4552
run: |
4653
tar -czvf ${{ github.workspace }}/${{ inputs.artifact-name }} ${{ github.workspace }}/nuget
47-
54+
4855
- id: get_version
4956
uses: ./.github/actions/get-version
5057

@@ -61,6 +68,6 @@ jobs:
6168
PRODSEC_TOOLS_USER: ${{ secrets.PRODSEC_TOOLS_USER }}
6269
PRODSEC_TOOLS_TOKEN: ${{ secrets.PRODSEC_TOOLS_TOKEN }}
6370
PRODSEC_TOOLS_ARN: ${{ secrets.PRODSEC_TOOLS_ARN }}
64-
71+
6572
- name: Output scan result
6673
run: echo "scan-status=${{ steps.rl-scan-conclusion.outcome }}" >> $GITHUB_ENV

0 commit comments

Comments
 (0)