Skip to content

Commit

Permalink
Add GH Actions CI
Browse files Browse the repository at this point in the history
  • Loading branch information
siimav committed Sep 21, 2024
1 parent b1ac15b commit a6258a3
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 4 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/asp.net-core-webapp-on-azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Deploy ASP.NET Core app to Azure Web App

on:
push:
branches:
- test
pull_request:
branches:
- '*'
# CONFIGURATION
# For help, go to https://github.com/Azure/Actions
#
# 1. Set up the following secrets in your repository:
# AZURE_WEBAPP_PUBLISH_PROFILE
#
# 2. Change these variables for your configuration:
env:
AZURE_WEBAPP_NAME: your-app-name # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: '6.0.x' # set this to the dot net version to use
NODE_VERSION: '20.x' # set this to the node version to use

jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment: dev
steps:

# Checkout the repo
- uses: actions/checkout@v4

# Setup .NET Core SDK
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

# Run dotnet build and publish
- name: dotnet build and publish
run: |
dotnet restore
dotnet build --configuration Release
dotnet publish -c Release -o '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp'
# Deploy to Azure Web apps
- name: 'Run Azure webapp deploy action using publish profile credentials'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name
slot-name: 'test'
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} # Define secret variable in repository settings as per action documentation
package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp'
6 changes: 2 additions & 4 deletions RP1AnalyticsWebApp.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29728.190
# Visual Studio Version 17
VisualStudioVersion = 17.7.34221.43
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RP1AnalyticsWebApp", "RP1AnalyticsWebApp\RP1AnalyticsWebApp.csproj", "{05A4ABFE-19A0-4C2F-B8DA-D2FF352C0FA0}"
EndProject
Expand All @@ -18,9 +18,7 @@ Global
{05A4ABFE-19A0-4C2F-B8DA-D2FF352C0FA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05A4ABFE-19A0-4C2F-B8DA-D2FF352C0FA0}.Release|Any CPU.Build.0 = Release|Any CPU
{0765EEF9-9D48-4263-871C-65CC65FC9C03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0765EEF9-9D48-4263-871C-65CC65FC9C03}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0765EEF9-9D48-4263-871C-65CC65FC9C03}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0765EEF9-9D48-4263-871C-65CC65FC9C03}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit a6258a3

Please sign in to comment.