Skip to content

Instantly share code, notes, and snippets.

@eaton-sam
Created June 17, 2020 21:21
Show Gist options
  • Save eaton-sam/fca3c07ecc716bdde4b2f1fb3444f8e2 to your computer and use it in GitHub Desktop.
Save eaton-sam/fca3c07ecc716bdde4b2f1fb3444f8e2 to your computer and use it in GitHub Desktop.
Action yml for hosting a blazor wasm app on AWS s3, behind cloudfront. Build, publish, push to s3, force cloudfront cache refresh.
name: .NET Core
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.301
- name: Install dependencies
run: dotnet restore ProjectDir/WasmProject.csproj
- name: Build
run: dotnet build ProjectDir/WasmProject.csproj --configuration Release --no-restore
- name: Publish
run: dotnet publish ProjectDir/WasmProject.csproj -c Release --no-build -o publishOutput
- name: Upload to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
AWS_S3_BUCKET: ${{secrets.AWS_S3_BUCKET}}
SOURCE_DIR: 'publishOutput/wwwroot'
- name: Invalidate Cloudfront
uses: chetan/invalidate-cloudfront-action@master
env:
DISTRIBUTION: ${{SECRETS.AWS_CLOUDFRONT_DIST}}
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
AWS_REGION: 'eu-west-2'
PATHS: '/*'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment