Skip to content

Bump the dotnet group in /src/Cropper.Blazor with 7 updates (#382) #1

Bump the dotnet group in /src/Cropper.Blazor with 7 updates (#382)

Bump the dotnet group in /src/Cropper.Blazor with 7 updates (#382) #1

Workflow file for this run

name: Deploy to GitHub Pages
concurrency:
group: github-pages
cancel-in-progress: true
on:
push:
branches: [ dev ]
paths-ignore:
- '**.md'
jobs:
code-quality-check:
name: Check code quality
uses: CropperBlazor/Cropper.Blazor/.github/workflows/build-test-template.yml@dev
secrets: inherit
deploy-to-github-pages:
runs-on: ubuntu-latest
environment: github-pages
needs: [code-quality-check, demo-projects-build]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Restore dependencies
run: dotnet restore
working-directory: src/Cropper.Blazor
- name: Restore dotnet tool
run: dotnet tool restore
working-directory: src/Cropper.Blazor/Cropper.Blazor
- name: Wait for Exit Code 0 for Cropper.Blazor.Sitemap.Generator project
run: |
dotnet run -c Release
working-directory: src/Cropper.Blazor/Cropper.Blazor.Sitemap.Generator
- name: Check if sitemap.xml File Exists
run: |
filePath="./sitemap.xml"
if [ -f "$filePath" ]; then
echo "sitemap.xml file exists"
else
echo "File does not exist"
exit 1
fi
working-directory: src/Cropper.Blazor/Client/wwwroot
# publishes Blazor project to the release-folder
- name: Publish .NET Core Project
run: dotnet publish ./src/Cropper.Blazor/Client/Cropper.Blazor.Client.csproj -c Release --output release --nologo
# changes the base-tag in index.html from '/' to 'Cropper.Blazor' to match GitHub Pages repository subdirectory
#- name: Change base-tag in index.html from / to Cropper.Blazor
# run: sed -i 's/<base href="\/" \/>/<base href="\/Cropper.Blazor\/" \/>/g' release/wwwroot/index.html
- name: Fix service-worker-assets.js hashes
working-directory: release/wwwroot
run: |
jsFile=$(<service-worker-assets.js)
# remove JavaScript from contents so it can be interpreted as JSON
json=$(echo "$jsFile" | sed "s/self.assetsManifest = //g" | sed "s/;//g")
# grab the assets JSON array
assets=$(echo "$json" | jq '.assets[]' -c)
for asset in $assets
do
oldHash=$(echo "$asset" | jq '.hash')
#remove leading and trailing quotes
oldHash="${oldHash:1:-1}"
path=$(echo "$asset" | jq '.url')
#remove leading and trailing quotes
path="${path:1:-1}"
# shellcheck disable=2086
newHash="sha256-$(openssl dgst -sha256 -binary $path | openssl base64 -A)"
# shellcheck disable=2086
if [ $oldHash != $newHash ]; then
# escape slashes for json
# shellcheck disable=2001
oldHash=$(echo "$oldHash" | sed 's;/;\\/;g')
# shellcheck disable=2001
newHash=$(echo "$newHash" | sed 's;/;\\/;g')
echo "Updating hash for $path from $oldHash to $newHash"
# escape slashes second time for sed
# shellcheck disable=2001
oldHash=$(echo "$oldHash" | sed 's;/;\\/;g')
jsFile=$(echo -n "$jsFile" | sed "s;$oldHash;$newHash;g")
fi
done
echo -n "$jsFile" > service-worker-assets.js
# copy index.html to 404.html to serve the same file when a file is not found
- name: copy index.html to 404.html
run: cp release/wwwroot/index.html release/wwwroot/404.html
# add .nojekyll file to tell GitHub pages to not treat this as a Jekyll project. (Allow files and folders starting with an underscore)
- name: Add .nojekyll file
run: touch release/wwwroot/.nojekyll
- name: Uploading files to gh-pages branch
uses: JamesIves/[email protected]
with:
token: ${{ secrets.DEPLOY_KEY }}
branch: gh-pages
folder: release/wwwroot
repository-name: CropperBlazor/CropperBlazor.github.io
demo-projects-build:
name: Build Demo Projects
runs-on: windows-latest
needs: code-quality-check
env:
JAVA_HOME: '/home/runner/android-sdk'
steps:
- uses: actions/checkout@v4
- name: Setup .NET 8, 7, 6
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Cache JDK
id: cache-jdk
uses: actions/cache@v4
with:
path: ${{ env.JAVA_HOME }}
key: ${{ runner.os }}-jdk-11
restore-keys: |
${{ runner.os }}-jdk-
- name: Setup Java JDK
if: steps.cache-jdk.outputs.cache-hit != 'true'
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: 11
- name: search workloads
run: dotnet workload search
- name: Install Windows, Android MAUI Workloads
run: |
dotnet workload install maui-windows maui-android --from-rollback-file https://maui.blob.core.windows.net/metadata/rollbacks/8.0.1xx.json --ignore-failed-sources
dotnet workload install wasm-tools --ignore-failed-sources
- name: list workloads
run: dotnet workload list
- name: Restore dotnet workload
run: dotnet workload restore
working-directory: examples
- name: Restore dependencies for Cropper.Blazor.Demo
run: dotnet restore
working-directory: examples
- name: Restore dotnet tool
run: dotnet tool restore
working-directory: src/Cropper.Blazor/Cropper.Blazor
- name: DotNet Build MVC with Blazor Server Demo Project for .net 7
run: dotnet build --no-restore
working-directory: examples\Cropper.MVC.With.Blazor.Server.Net7
- name: DotNet Build Blazor Server Demo Project for .net 7
run: dotnet build --no-restore
working-directory: examples\Cropper.Blazor.Server.Net7
- name: DotNet Build Blazor MAUI Demo Project for .net 7
run: dotnet build --no-restore
working-directory: examples\Cropper.Blazor.MAUI.Net7
- name: DotNet Build Blazor Server Demo Project for .net 6
run: dotnet build --no-restore
working-directory: examples\Cropper.Blazor.Server.Net6
# - name: DotNet Build Blazor MAUI Demo Project for .net 6
# run: dotnet build --no-restore
# working-directory: examples\Cropper.Blazor.MAUI.Net6
- name: DotNet Build Blazor Server Demo Project for .net 8
run: dotnet build --no-restore
working-directory: examples\Cropper.Blazor.Server.Net8
- name: DotNet Build Blazor MAUI Demo Project for .net 8
run: dotnet build --no-restore
working-directory: examples\Cropper.Blazor.MAUI.Net8