-
Notifications
You must be signed in to change notification settings - Fork 126
44 lines (44 loc) · 1.62 KB
/
Website Deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Website Deploy
on:
push:
branches:
- main
paths:
- 'Projects/Website/**'
#paths-ignore:
#- '.vscode/**'
#- '.github/**'
#- 'LICENSE'
#- 'README.md'
#- 'CODE_OF_CONDUCT.md'
#- '**.md'
workflow_dispatch:
jobs:
deployment:
if: ${{ github.repository == 'dotnet/dotnet-console-games' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: publish website
run: dotnet publish Projects/Website/Website.csproj --configuration Release
- name: index.html base tag
run: sed -i 's/<base href="\/" \/>/<base href="\/dotnet-console-games\/" \/>/g' Projects/Website/bin/Release/publish/wwwroot/index.html
- name: 404.html
run: sed -i 's/\/?p=\//\/dotnet-console-games\/?p=\//g' Projects/Website/bin/Release/publish/wwwroot/404.html
- name: .nojekyll
run: touch Projects/Website/bin/Release/publish/wwwroot/.nojekyll
- name: CODEOWNERS
run: echo "* @ZacharyPatten" > Projects/Website/bin/Release/publish/wwwroot/CODEOWNERS
- name: push to github-pages branch
run: |
cd Projects/Website/bin/Release/publish/wwwroot
git init --initial-branch=github-pages
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add .
git commit -m 'deploy to github-pages branch'
git push --force "https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" github-pages:github-pages