Skip to content
70 changes: 70 additions & 0 deletions .github/workflows/pr-verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: PR Verify

# These are the veriables which you could use in your workflows
env:
AZURE_WEBAPP_NAME: app-dev-rajsonawala.azurewebsites.net # set this to the name of your Azure Web App
AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: '8.0' # set this to the .NET Core version to use

on:
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:
name: PR Verify
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Build with dotnet
run: dotnet build --configuration Release

- name: Running test
run: dotnet test --configuration Release --no-build

- name: publish project
run: dotnet publish src/GitHubActionsDotNet.Api/GitHubActionsDotNet.Api.csproj --configuration Release -o artifacts

- uses: actions/upload-artifact@v4
with:
name: my-artifact
path: artifacts/

deploy_dev:
name: Deploy Dev
runs-on: ubuntu-latest
needs: build # wait for other job to finish g

steps:
- uses: actions/download-artifact@v4
with:
name: my-artifact
path: artifacts/

- name: Azure login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenate-id: ${{ secrets.AZURE_TENATE_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}


# Deploy to Azure Web apps
- name: 'Deploy to Azure App Service'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name
package: 'artifacts/'



24 changes: 24 additions & 0 deletions .github/workflows/secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Secrets workflow

# These are the veriables which you could use in your workflows
env:
API_CSPROJ_PATH: "./src/GitHubActionsDotNet.Api/GitHubActionsDotNet.Api.csproj"

on:
pull_request:
branches: ["main"]


jobs:
secrets:
name: Secrets Demo
runs-on: ubuntu-latest

steps:
- name: echo environment variable
run: echo "$API_CSPROJ_PATH is value ${{ secrets.SECRET_API_KEY }}"





3 changes: 2 additions & 1 deletion src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ public record WeatherForecast

public int TemperatureC { get; init; }

public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public int TemperatureF => 32 + (int)(TemperatureC / 0.555633);

public string? Summary { get; init; }
}