Skip to content

Commit 12b1076

Browse files
committed
ok
Former-commit-id: 3c6e96c
1 parent 51f51e1 commit 12b1076

File tree

4 files changed

+43
-51
lines changed

4 files changed

+43
-51
lines changed

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,30 @@ GitHub Action to fix the sha256 file-hashes in:
44
- blazor.boot.json
55
- service-worker-assets.js
66

7-
## Inputs
7+
## Why
88

9-
### `wwwroot-path`
9+
In case you deploy your Blazor Web on GitHub Pages are use the *SteveSandersonMS/ghaction-rewrite-base-href*-Action,
10+
the index.html is modified and when running the Blazor WebAssembly using a service-worker, you can get this error in the console:
11+
12+
```
13+
Failed to find a valid digest in the 'integrity' attribute for resource 'https://stefh.github.io/xxx/index.html' with computed SHA-256 integrity '/C6AMmjXzNTqgqy8YOF4zcMbioqALgdg/bbhWojItcw='. The resource has been blocked.
14+
Unknown error occurred while trying to verify integrity.
15+
service-worker.js:1 Uncaught (in promise) TypeError: Failed to fetch
16+
```
17+
18+
## Solution
19+
20+
Use this GitHub Action to fix the SHA56 hashes from in the blazor.boot.json and service-worker-assets.js
21+
22+
## Usage
23+
24+
### Inputs
25+
26+
#### `wwwroot-path`
1027

1128
**Required** The path to the wwwroot folder. Default this is `.`.
1229

13-
## Example usage
30+
### Example
1431

1532
``` yml
1633
- name: BlazorWebAssemblyFileHashFixer
Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,20 @@
1-
# FROM mcr.microsoft.com/dotnet/core/sdk:3.1-bionic AS build-env
1+
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-bionic AS build-env
22

3-
# LABEL maintainer="Stef Heyenrath"
4-
5-
# WORKDIR /app
3+
LABEL maintainer="Stef Heyenrath"
64

7-
# copy csproj and restore as distinct layers
8-
# COPY BlazorWebAssemblyFileHashFixer.csproj ./
9-
# RUN dotnet restore
5+
WORKDIR /app
106

11-
# copy everything else and build
12-
# COPY *.cs ./
7+
COPY BlazorWebAssemblyFileHashFixer.csproj ./
8+
COPY *.cs ./
9+
COPY *.json ./
1310

14-
# RUN dotnet publish -c Release -r linux-x64 -o out --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true
11+
RUN dotnet publish -c Release -r linux-x64 -o out --self-contained true -p:PublishSingleFile=true
1512

16-
# build runtime image
17-
# FROM mcr.microsoft.com/dotnet/core/runtime:3.1-bionic
18-
# WORKDIR /app
19-
# COPY --from=build-env /app/out ./
20-
# RUN chmod +x ./fixer
21-
# ENTRYPOINT ["./fixer"]
13+
RUN ls -al
14+
RUN ls -al out
2215

2316
FROM mcr.microsoft.com/dotnet/core/runtime:3.1-bionic
24-
25-
LABEL maintainer="Stef Heyenrath"
26-
27-
# Copies your code file from your action repository to the filesystem path `/` of the container
28-
COPY ./out/fixer fixer
29-
30-
RUN chmod +x ./fixer
31-
32-
# Code file to execute when the docker container starts up (`entrypoint.sh`)
17+
WORKDIR /app
18+
COPY --from=build-env /app/out/fixer /fixer
19+
RUN chmod +x /fixer
3320
ENTRYPOINT ["/fixer"]

src/BlazorWebAssemblyFileHashFixer/Dockerfile.multi

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM mcr.microsoft.com/dotnet/core/runtime:3.1-bionic
2+
3+
LABEL maintainer="Stef Heyenrath"
4+
5+
# Copies your code file from your action repository to the filesystem path `/` of the container
6+
COPY ./out/fixer fixer
7+
8+
RUN chmod +x ./fixer
9+
10+
# Code file to execute when the docker container starts up (`entrypoint.sh`)
11+
ENTRYPOINT ["/fixer"]

0 commit comments

Comments
 (0)