Skip to content

Commit

Permalink
- Adds Github CI/CD workflow on master branch.
Browse files Browse the repository at this point in the history
- Changes database connection string paths because the cloud platform we use for deployment does not support the previous path.
  • Loading branch information
emaadgh committed May 15, 2024
1 parent 59aa016 commit 21346b6
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/liara.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: QuickLinker-CI/CD

env:
DOTNET_VERSION: '8'
SOLUTION_NAME: 'QuickLinker.sln'

on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Restore packages
run: dotnet restore ${{ env.SOLUTION_NAME }}

- name: Build
run: dotnet build ${{ env.SOLUTION_NAME }} --no-restore

- name: Run tests
run: dotnet test ${{ env.SOLUTION_NAME }} --no-build --verbosity normal
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18"
- name: update-liara
env:
LIARA_TOKEN: ${{ secrets.LIARA_API_TOKEN }}
run: |
npm i -g @liara/cli@5
liara deploy --app="quicklinker" --api-token="$LIARA_TOKEN" --no-app-logs --port 80
4 changes: 2 additions & 2 deletions QuickLinker/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
}).AddNewtonsoftJson();

builder.Services.AddDbContext<QuickLinkerDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("QuickLinkerDbContextConnection")));
options.UseSqlServer(builder.Configuration["QuickLinkerDbContextConnection"]));

builder.Services.AddTransient<IQuickLinkerRepository, QuickLinkerRepository>();
builder.Services.AddScoped<IShortLinkService, ShortLinkService>();

builder.Services.AddStackExchangeRedisCache(options =>
{
options.Configuration = builder.Configuration.GetConnectionString("QuickLinkerRedisConnection");
options.Configuration = builder.Configuration["QuickLinkerRedisConnection"];
options.InstanceName = "QuickLinker";
});

Expand Down

0 comments on commit 21346b6

Please sign in to comment.