-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch deployment to release branch, do build / test on main branch
- Loading branch information
1 parent
ce109ae
commit 51f7bd0
Showing
2 changed files
with
56 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Build and Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
# use ubuntu-latest image to run steps on | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# uses GitHub's checkout action to checkout code form the release branch | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
|
||
# sets up .NET SDK | ||
- name: Setup .NET | ||
uses: actions/[email protected] | ||
with: | ||
global-json-file: ./global.json | ||
|
||
- name: Install WASM workload | ||
run: dotnet workload install wasm-tools | ||
|
||
- name: Restore dependencies | ||
run: dotnet restore | ||
|
||
- name: Build | ||
run: dotnet build --configuration Release --no-restore | ||
|
||
- name: Run tests | ||
run: dotnet test --configuration Release --no-build |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,39 @@ | ||
name: Deploy to GitHub Pages | ||
|
||
# Run workflow on every successful run of the CodeQL workflow | ||
on: | ||
push: | ||
branches: [ "main" ] | ||
branches: | ||
- release | ||
|
||
jobs: | ||
deploy-to-github-pages: | ||
deploy: | ||
# use ubuntu-latest image to run steps on | ||
runs-on: ubuntu-latest | ||
steps: | ||
# uses GitHub's checkout action to checkout code form the main branch | ||
- uses: actions/[email protected] | ||
# uses GitHub's checkout action to checkout code form the release branch | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
|
||
# sets up .NET SDK | ||
- name: Setup .NET Core SDK | ||
uses: actions/setup-dotnet@v4.0.0 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4.1.0 | ||
with: | ||
global-json-file: ./global.json | ||
|
||
- name: Install WASM workload | ||
run: dotnet workload install wasm-tools | ||
|
||
- name: Test | ||
run: dotnet test | ||
- name: Restore dependencies | ||
run: dotnet restore | ||
|
||
- name: Build | ||
run: dotnet build --configuration Release --no-restore | ||
|
||
- name: Run tests | ||
run: dotnet test --configuration Release --no-build | ||
|
||
# publishes Blazor project to the release-folder | ||
- name: Publish .NET Core Project | ||
- name: Publish .NET Project | ||
run: dotnet publish Pkmds.Web/Pkmds.Web.csproj -c Release -o release --nologo | ||
|
||
# copy index.html to 404.html to serve the same file when a file is not found | ||
|
@@ -37,14 +44,14 @@ jobs: | |
- name: Add .nojekyll file | ||
run: touch release/wwwroot/.nojekyll | ||
|
||
- name: UpdateVersion | ||
- name: Update version | ||
uses: datamonsters/replace-action@v2 | ||
with: | ||
files: 'release/wwwroot/service-worker.published.js' | ||
replacements: '%%CACHE_VERSION%%=${{ github.run_id }}' | ||
|
||
- name: Commit wwwroot to GitHub Pages | ||
uses: JamesIves/github-pages-deploy-action@v4.5.0 | ||
uses: JamesIves/github-pages-deploy-action@v4.7.2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: gh-pages | ||
|