update to v4 #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: dotnet-CD | |
on: | |
push: | |
branches: [ "main" ] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up dependency caching for faster builds | |
uses: actions/cache@v4 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- name: Build with dotnet | |
run: dotnet build rubberduckvba.Server --configuration Release | |
- name: dotnet publish | |
run: dotnet publish "rubberduckvba.Server\rubberduckvba.Server.csproj" --configuration Release --output ${{env.DOTNET_ROOT}}\pub | |
- name: Upload artifact for deployment job | |
uses: actions/upload-artifact@v4 | |
with: | |
name: .net-app | |
path: ${{env.DOTNET_ROOT}}/pub | |
deploy: | |
environment: | |
name: AZ-Test | |
url: https://test.rubberduckvba.com | |
permissions: | |
contents: none | |
runs-on: windows-latest | |
needs: build | |
steps: | |
- name: Download artifact from build job | |
uses: actions/download-artifact@v4 | |
with: | |
name: .net-app | |
- name: Deploy to IIS | |
id: deploy-to-iis | |
uses: ChristopheLav/iis-deploy@v1 | |
with: | |
website-name: 'api' | |
msdeploy-service-url: ${{ secrets.MSDEPLOY_URL }} | |
msdeploy-username: ${{ secrets.MSDEPLOY_USERNAME }} | |
msdeploy-password: ${{ secrets.MSDEPLOY_PASSWORD }} | |
source-path: ${{ github.workspace }}\website\publish |