Skip to content

Starter no infra #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: starter-no-infra
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/starter-no-infra_juiceddegens.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy ASP.Net Core app to Azure Web App - JuicedDegens

on:
push:
branches:
- starter-no-infra
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'

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

- name: dotnet publish
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp

- name: Install dotnet ef
run: dotnet tool install -g dotnet-ef --version 8.*

- name: Create migrations bundle
run: dotnet ef migrations bundle --runtime linux-x64 -o ${{env.DOTNET_ROOT}}/myapp/migrationsbundle

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: .net-app
path: ${{env.DOTNET_ROOT}}/myapp

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write #This is required for requesting the JWT

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: .net-app

- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_BFBEB0438D0441B2A695A864920668F3 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_136A69801EAA41C8BD7ED2B58309104B }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_A0F6E8B5D57947AAABCB146E7B420A18 }}

- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: 'JuicedDegens'
slot-name: 'Production'
package: .

3 changes: 3 additions & 0 deletions Data/MyDatabaseContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using DotNetCoreSqlDb.Models;
using DotNetCoreSqlDb.Models.WagerItems;

namespace DotNetCoreSqlDb.Data
{
Expand All @@ -15,5 +16,7 @@ public MyDatabaseContext (DbContextOptions<MyDatabaseContext> options)
}

public DbSet<DotNetCoreSqlDb.Models.Todo> Todo { get; set; } = default!;
public DbSet<Degenerate> Degenerate { get; set; } = default!;
public DbSet<WagerItem> WagerItem { get; set; } = default!;
}
}
49 changes: 49 additions & 0 deletions Migrations/20240918040408_myCreate.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions Migrations/20240918040408_myCreate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace DotNetCoreSqlDb.Migrations
{
/// <inheritdoc />
public partial class myCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{

}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{

}
}
}
132 changes: 132 additions & 0 deletions Migrations/20240918042929_includeWagerAndDegenerate.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions Migrations/20240918042929_includeWagerAndDegenerate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace DotNetCoreSqlDb.Migrations
{
/// <inheritdoc />
public partial class includeWagerAndDegenerate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Degenerate",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Username = table.Column<string>(type: "nvarchar(max)", nullable: true),
CashWallet = table.Column<double>(type: "float", nullable: false),
BetsPlaced = table.Column<int>(type: "int", nullable: false),
BetsWon = table.Column<int>(type: "int", nullable: false),
TotalWagesPlaced = table.Column<double>(type: "float", nullable: false),
TotalWagesWon = table.Column<double>(type: "float", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Degenerate", x => x.Id);
});

migrationBuilder.CreateTable(
name: "WagerItem",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
UserId = table.Column<int>(type: "int", nullable: false),
MatchId = table.Column<int>(type: "int", nullable: false),
SportType = table.Column<int>(type: "int", nullable: false),
WagerValue = table.Column<double>(type: "float", nullable: false),
BetType = table.Column<int>(type: "int", nullable: false),
Odds = table.Column<int>(type: "int", nullable: false),
Active = table.Column<bool>(type: "bit", nullable: false),
Outcome = table.Column<bool>(type: "bit", nullable: true),
TimeOfBet = table.Column<DateTime>(type: "datetime2", nullable: false),
WagerTeamA = table.Column<string>(type: "nvarchar(max)", nullable: true),
WagerTeamB = table.Column<string>(type: "nvarchar(max)", nullable: true),
WagerJuice = table.Column<int>(type: "int", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_WagerItem", x => x.Id);
});
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Degenerate");

migrationBuilder.DropTable(
name: "WagerItem");
}
}
}
Loading