Skip to content

Update upload-artifact action to v4 #12

Update upload-artifact action to v4

Update upload-artifact action to v4 #12

name: Deploy to GitHub Pages
env:
PUBLISH_DIR: src/Blazor.Client.HelloWorld/bin/Release/net8.0/publish/wwwroot
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
- name: Publish app
run: dotnet publish ./src/Blazor.Client.HelloWorld/Blazor.Client.HelloWorld.csproj -c Release
- name: Rewrite base href
uses: SteveSandersonMS/ghaction-rewrite-base-href@v1
with:
html_path: ${{ env.PUBLISH_DIR }}/index.html
base_href: /BlazorOnGitHubPages/
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: published-app
path: ${{ env.PUBLISH_DIR }}
deploy:
runs-on: ubuntu-latest
# Add a dependency to the build job
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
actions: read # to download an artifact uploaded by `actions/upload-pages-artifact@v3`
# Deploy to the github-pages environment
environment:
name: github-pages
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifact_name: published-app
- name: Update environment
run: echo "PAGE_URL=https://${{ github.repository_owner }}.github.io/${{ github.repository }}" >> $GITHUB_ENV