Skip to content

Commit 0730f34

Browse files
committed
Fix workflows
1 parent f85428c commit 0730f34

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

.github/workflows/csharp.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ jobs:
8585
echo "Package: $PACKAGE_ID@$PACKAGE_VERSION"
8686
8787
# Check if version exists on GitHub Packages
88-
if curl -f -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
89-
"https://nuget.pkg.github.com/linksplatform/download/$PACKAGE_ID/$PACKAGE_VERSION/$PACKAGE_ID.$PACKAGE_VERSION.nupkg" > /dev/null 2>&1; then
88+
# Use NuGet API to check if package version exists
89+
if curl -f -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
90+
"https://api.github.com/user/packages/nuget/$PACKAGE_ID/versions" 2>/dev/null | grep -q "\"name\": \"$PACKAGE_VERSION\""; then
9091
echo "Version $PACKAGE_VERSION already exists on GitHub Packages"
9192
echo "should_publish=false" >> $GITHUB_OUTPUT
9293
else
@@ -189,12 +190,18 @@ jobs:
189190
uses: actions/setup-dotnet@v3
190191
with:
191192
dotnet-version: '8.0.x' # Ensure this matches your project's target
193+
- name: Install dependencies for PDF generation
194+
run: |
195+
sudo apt-get update
196+
sudo apt-get install -y texlive texlive-lang-cyrillic texlive-latex-extra python3-pygments ghostscript
192197
- name: Generate PDF with code
193198
run: |
194199
export REPOSITORY_NAME=$(basename ${{ github.repository }})
195200
wget "$SCRIPTS_BASE_URL/format-csharp-files.py"
196201
wget "$SCRIPTS_BASE_URL/format-csharp-document.sh"
197202
wget "$SCRIPTS_BASE_URL/generate-csharp-pdf.sh"
203+
# Replace python-pygments with python3-pygments in the script
204+
sed -i 's/python-pygments/python3-pygments/g' ./generate-csharp-pdf.sh
198205
bash ./generate-csharp-pdf.sh
199206
200207
publishDocumentation:
@@ -209,11 +216,18 @@ jobs:
209216
uses: actions/setup-dotnet@v3
210217
with:
211218
dotnet-version: '8.0.x' # Ensure this matches your project's target
219+
- name: Install NuGet for documentation
220+
run: |
221+
# Install dotnet SDK which includes nuget functionality
222+
# No need to install separate nuget package in Ubuntu 24.04
223+
echo "Using dotnet SDK's built-in NuGet functionality"
212224
- name: Publish documentation to gh-pages branch
213225
run: |
214226
export REPOSITORY_NAME=$(basename ${{ github.repository }})
215227
wget "$SCRIPTS_BASE_URL/docfx.json"
216228
wget "$SCRIPTS_BASE_URL/filter.yml"
217229
wget "$SCRIPTS_BASE_URL/toc.yml"
218230
wget "$SCRIPTS_BASE_URL/publish-csharp-docs.sh"
231+
# Replace nuget command with dotnet nuget in the script if needed
232+
sed -i 's/nuget install/dotnet add package/g' ./publish-csharp-docs.sh || true
219233
bash ./publish-csharp-docs.sh

.github/workflows/js.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,9 @@ jobs:
124124
echo "Package: $PACKAGE_NAME@$PACKAGE_VERSION"
125125
126126
# Check if version exists on GitHub Packages
127-
if curl -f -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
128-
"https://npm.pkg.github.com/$PACKAGE_NAME/$PACKAGE_VERSION" > /dev/null 2>&1; then
127+
# GitHub Packages uses different API endpoint
128+
if curl -f -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
129+
"https://api.github.com/user/packages/npm/${PACKAGE_NAME}/versions" 2>/dev/null | grep -q "\"name\": \"$PACKAGE_VERSION\""; then
129130
echo "Version $PACKAGE_VERSION already exists on GitHub Packages"
130131
echo "should_publish=false" >> $GITHUB_OUTPUT
131132
else

0 commit comments

Comments
 (0)