Skip to content

Commit

Permalink
Attempt to fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Konard committed Jan 6, 2025
1 parent bae8007 commit 206df74
Showing 1 changed file with 111 additions and 66 deletions.
177 changes: 111 additions & 66 deletions .github/workflows/csharp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
NUGETTOKEN: ${{ secrets.NUGET_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SCRIPTS_BASE_URL: https://raw.githubusercontent.com/linksplatform/Scripts/main/MultiProjectRepository

defaults:
run:
working-directory: csharp
Expand All @@ -19,50 +19,84 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x' # Specify your desired .NET version
- name: Restore Dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: |
dotnet test -c Release -f net8
run: dotnet test --configuration Release --no-build -f net8

pushNuGetPackageToGitHubPackageRegistry:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
submodules: true
- uses: nuget/setup-nuget@v1
- name: Publish NuGet package to GitHub Package Registry
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x' # Ensure this matches your project's target
- name: Restore Dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Pack
run: dotnet pack --configuration Release --no-build --output ./nupkg
- name: Configure NuGet Source
run: |
dotnet build -c Release
dotnet pack -c Release
nuget source Add -Name "GitHub" -Source "https://nuget.pkg.github.com/linksplatform/index.json" -UserName linksplatform -Password ${{ secrets.GITHUB_TOKEN }}
nuget push **/*.nupkg -Source "GitHub" -SkipDuplicate
dotnet nuget add source "https://nuget.pkg.github.com/linksplatform/index.json" \
--name "github" \
--username "linksplatform" \
--password "${{ secrets.GITHUB_TOKEN }}" \
--store-password-in-clear-text
- name: Push NuGet Package to GitHub Package Registry
run: |
dotnet nuget push ./nupkg/*.nupkg \
--source "github" \
--skip-duplicate \
--api-key ${{ secrets.GITHUB_TOKEN }}
pusnToNuget:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Read project information
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/read_csharp_package_info.sh"
bash ./read_csharp_package_info.sh
- name: Publish NuGet package
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/push-csharp-nuget.sh"
bash ./push-csharp-nuget.sh
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x' # Ensure this matches your project's target
- name: Read project information
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/read_csharp_package_info.sh"
bash ./read_csharp_package_info.sh
- name: Publish NuGet package
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/push-csharp-nuget.sh"
bash ./push-csharp-nuget.sh
publiseRelease:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x' # Ensure this matches your project's target
- name: Read project information
if: ${{ github.event_name == 'push' }}
run: |
Expand All @@ -76,60 +110,71 @@ jobs:
chmod +x ./publish-release.sh
wget "$SCRIPTS_BASE_URL/publish-csharp-release.sh"
bash ./publish-csharp-release.sh
findChangedCsFiles:
runs-on: ubuntu-latest
needs: test
outputs:
isCsFilesChanged: ${{ steps.setIsCsFilesChangedOutput.outputs.isCsFilesChanged }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed files using defaults
id: changed-files
uses: tj-actions/changed-files@v41
- name: Set output isCsFilesChanged
id: setIsCsFilesChangedOutput
run: |
isCsFilesChanged='false'
echo "Changed files: ${{ steps.changed-files.outputs.all_changed_files }}"
for changedFile in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ $changedFile == *.cs ]]
then
echo "isCsFilesChanged='true'"
isCsFilesChanged='true'
fi
done
echo "::set-output name=isCsFilesChanged::${isCsFilesChanged}"
echo "isCsFilesChanged: ${isCsFilesChanged}"
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed files using defaults
id: changed-files
uses: tj-actions/changed-files@v41
- name: Set output isCsFilesChanged
id: setIsCsFilesChangedOutput
run: |
isCsFilesChanged='false'
echo "Changed files: ${{ steps.changed-files.outputs.all_changed_files }}"
for changedFile in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ $changedFile == *.cs ]]; then
echo "isCsFilesChanged='true'"
isCsFilesChanged='true'
break
fi
done
echo "::set-output name=isCsFilesChanged::${isCsFilesChanged}"
echo "isCsFilesChanged: ${isCsFilesChanged}"
generatePdfWithCode:
runs-on: ubuntu-latest
needs: [findChangedCsFiles]
if: ${{ needs.findChangedCsFiles.outputs.isCsFilesChanged == 'true' }}
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Generate PDF with code
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/format-csharp-files.py"
wget "$SCRIPTS_BASE_URL/format-csharp-document.sh"
wget "$SCRIPTS_BASE_URL/generate-csharp-pdf.sh"
bash ./generate-csharp-pdf.sh
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x' # Ensure this matches your project's target
- name: Generate PDF with code
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/format-csharp-files.py"
wget "$SCRIPTS_BASE_URL/format-csharp-document.sh"
wget "$SCRIPTS_BASE_URL/generate-csharp-pdf.sh"
bash ./generate-csharp-pdf.sh
publishDocumentation:
runs-on: ubuntu-latest
needs: [findChangedCsFiles]
if: ${{ needs.findChangedCsFiles.outputs.isCsFilesChanged == 'true' }}
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Publish documentation to gh-pages branch
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/docfx.json"
wget "$SCRIPTS_BASE_URL/filter.yml"
wget "$SCRIPTS_BASE_URL/toc.yml"
wget "$SCRIPTS_BASE_URL/publish-csharp-docs.sh"
bash ./publish-csharp-docs.sh
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x' # Ensure this matches your project's target
- name: Publish documentation to gh-pages branch
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/docfx.json"
wget "$SCRIPTS_BASE_URL/filter.yml"
wget "$SCRIPTS_BASE_URL/toc.yml"
wget "$SCRIPTS_BASE_URL/publish-csharp-docs.sh"
bash ./publish-csharp-docs.sh

0 comments on commit 206df74

Please sign in to comment.