Skip to content

Commit

Permalink
updated deployment action
Browse files Browse the repository at this point in the history
used a version copied from another project (URL in source). 

one key change is the use of the `JamesIves/github-pages-deploy-action@3.7.1` action. in my previous attemps, this path looked like the name of the current repository, so i changed it to "connectuum/poemdown@main". now, however, it looks to me like this action is required -- it likely contains the steps/logic for deploying to GitHub Pages.
  • Loading branch information
connectuum committed Dec 22, 2021
1 parent 4a8b215 commit fc26cf0
Showing 1 changed file with 43 additions and 21 deletions.
64 changes: 43 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,44 @@
name: Build and Deploy
on:
push:
branches: [ main ]
# adapted from https://github.com/Swimburger/BlazorGitHubPagesDemo
name: Deploy to GitHub Pages

# Run workflow on every push to the main branch
on:
push:
branches: [ main ]

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- name: Publish with dotnet
run: dotnet publish -c Release -o build --nologo
- name: Deploy to Github Pages
uses: connectuum/poemdown@main
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BASE_BRANCH: main
BRANCH: gh-pages
FOLDER: build/wwwroot
deploy-to-github-pages:
# 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/checkout@v2

# sets up .NET Core SDK 3.1
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1

# publishes Blazor project to the release-folder
- name: Publish .NET Core Project
run: dotnet publish BlazorGitHubPagesDemo.csproj -c Release -o release --nologo

# changes the base-tag in index.html to match GitHub Pages repository subdirectory
- name: Change base-tag in index.html from / to /poemdown/
run: sed -i 's/<base href="\/" \/>/<base href="\/poemdown\/" \/>/g' release/wwwroot/index.html

# 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: Commit wwwroot to GitHub Pages
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: release/wwwroot

0 comments on commit fc26cf0

Please sign in to comment.