- Release v4.0.0 #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
'on': | |
pull_request: | |
types: [ opened, reopened, edited, synchronize ] | |
paths-ignore: | |
- "**/*.md" | |
- "**/*.gitignore" | |
- "**/*.gitattributes" | |
jobs: | |
Run-Lint: | |
runs-on: ubuntu-latest | |
env: | |
github-token: '${{ secrets.GH_Packages }}' | |
steps: | |
- name: Step-01 Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Step-02 Lint Code Base | |
uses: github/super-linter@v4 | |
env: | |
VALIDATE_ALL_CODEBASE: false | |
FILTER_REGEX_INCLUDE: .*src/.* | |
FILTER_REGEX_EXCLUDE: .*xsds/.* | |
DEFAULT_BRANCH: master | |
GITHUB_TOKEN: '${{ env.github-token }}' | |
Build-Beta: | |
if: ${{ !startsWith(github.head_ref, 'release/')}} | |
runs-on: ubuntu-latest | |
outputs: | |
semVersion: ${{ steps.gitversion.outputs.MajorMinorPatch }} | |
branchName: ${{ steps.gitversion.outputs.branchName }} | |
env: | |
working-directory: /home/runner/work/Secure.SAML/Secure.SAML | |
steps: | |
- name: Step-01 Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0.9.7 | |
with: | |
versionSpec: 5.x | |
- name: Step-02 Check out Code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Step-03 Calculate Version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0.9.7 | |
with: | |
useConfigFile: true | |
- name: Step-04 Install .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 9.0.x | |
- name: Step-05 Restore dependencies | |
run: dotnet restore | |
working-directory: '${{ env.working-directory }}' | |
- name: Step-06 Build Beta Version | |
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.nuGetVersion }} | |
working-directory: '${{ env.working-directory }}' | |
- name: Step-07 Test Solution | |
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal | |
working-directory: '${{ env.working-directory }}' | |
- name: Step-08 Upload Build Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-artifact | |
path: ${{env.working-directory}} | |
retention-days: 1 | |
Build-Release: | |
if: ${{ startsWith(github.head_ref, 'release/') }} | |
runs-on: ubuntu-latest | |
outputs: | |
semVersion: ${{ steps.gitversion.outputs.MajorMinorPatch }} | |
branchName: ${{ steps.gitversion.outputs.branchName }} | |
env: | |
working-directory: /home/runner/work/Secure.SAML/Secure.SAML | |
steps: | |
- name: Step-01 Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0.9.7 | |
with: | |
versionSpec: 5.x | |
- name: Step-02 Check out Code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Step-03 Calculate Version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0.9.7 | |
with: | |
useConfigFile: true | |
- name: Step-04 Install .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 9.0.x | |
- name: Step-05 Restore dependencies | |
run: dotnet restore | |
working-directory: '${{ env.working-directory }}' | |
- name: Step-06 Build Release Version | |
if: ('startsWith(github.ref, ''refs/heads/release'')') | |
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }} | |
working-directory: '${{ env.working-directory }}' | |
- name: Step-07 Test Solution | |
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal | |
working-directory: '${{ env.working-directory }}' | |
- name: Step-08 Upload Build Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-artifact | |
path: ${{env.working-directory}} | |
retention-days: 1 | |
Package-Artifacts: | |
needs: [ Build-Beta, Build-Release ] | |
if: | | |
always() && | |
(needs.Build-Beta.result == 'success' || needs.Build-Release.result == 'success') | |
runs-on: ubuntu-latest | |
outputs: | |
semVersion: ${{ needs.Build-Release.outputs.semVersion }} | |
env: | |
github-token: '${{ secrets.GH_Packages }}' | |
working-directory: /home/runner/work/Secure.SAML/Secure.SAML | |
steps: | |
- name: Step-01 Retrieve Build Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-artifact | |
path: ${{env.working-directory}} | |
- name: Step-02 Install Github Packages | |
run: dotnet tool install gpr --global | |
- name: Step-03 Publish to Github Packages | |
run: find -name "*.nupkg" -print -exec gpr push -k ${{env.github-token}} {} \; | |
Release: | |
needs: [ Package-Artifacts ] | |
if: | | |
success('Package-Artifacts') && | |
${{ startsWith(github.head_ref, 'release/') }} | |
runs-on: ubuntu-latest | |
env: | |
nuget-token: '${{ secrets.NUGET_API_KEY }}' | |
github-token: '${{ secrets.GH_Packages }}' | |
working-directory: /home/runner/work/Secure.SAML/Secure.SAML | |
steps: | |
- name: Step-01 Retrieve Build Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-artifact | |
path: ${{env.working-directory}} | |
- name: Step-02 Create Github Release | |
run: | | |
curl \ | |
-X POST \ | |
-H "Accept:application/vnd.github+json" \ | |
-H "Authorization:token ${{ env.github-token }}" \ | |
https://api.github.com/codeshayk/Secure.SAML/releases \ | |
-d '{"tag_name":v${{ needs.Package-Artifacts.outputs.semVersion }},"target_commitish":"master","name":"Secure.SAML","body":"Relese version ${{ needs.Package.outputs.semVersion }}","draft":false,"prerelease":false,"generate_release_notes":false}' | |
- name: Step-03 Publish to Nuget Org | |
run: dotnet nuget push ${{env.working-directory}}/src/Secure.SAML/bin/Release/*.nupkg --skip-duplicate --api-key ${{ env.nuget-token }} --source https://api.nuget.org/v3/index.json | |