50 أسطر
1.0 KiB
YAML
50 أسطر
1.0 KiB
YAML
name: .NET
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: dotnet-sample
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v2
|
|
with:
|
|
dotnet-version: 6.0.x
|
|
- name: Set up dependency caching for faster builds
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.nuget/packages
|
|
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-nuget-
|
|
|
|
- name: Build with dotnet
|
|
run: dotnet build --configuration Release
|
|
|
|
- name: dotnet publish
|
|
run: dotnet publish -c Release -o ./webapp
|
|
|
|
- name: Upload artifact for deployment job
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: webapp
|
|
path: ./dotnet-sample/webapp
|
|
|
|
- name: Upload artifact for deployment job
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: iac
|
|
path: ./dotnet-sample/iac
|