From 736de38de40875b42a859d4d3c224bc346f99db7 Mon Sep 17 00:00:00 2001 From: Darren Reid Date: Thu, 21 Nov 2024 11:41:27 +1100 Subject: [PATCH] feat: add Kamal deployment configuration --- .github/workflows/build-container.yml | 7 +++++-- .github/workflows/release.yml | 5 ++++- MyApp/MyApp.csproj | 1 + config/deploy.yml | 4 ++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index 82925e1..c226633 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -7,6 +7,9 @@ on: workflows: ["Build"] types: - completed + branches: + - main + - master workflow_dispatch: env: @@ -45,10 +48,10 @@ jobs: run: | sed -i 's###g' MyApp/MyApp.csproj - - name: Check for Client directory + - name: Check for Client directory and package.json id: check_client run: | - if [ -d "MyApp.Client" ]; then + if [ -d "MyApp.Client" ] && [ -f "MyApp.Client/package.json" ]; then echo "client_exists=true" >> $GITHUB_OUTPUT else echo "client_exists=false" >> $GITHUB_OUTPUT diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6a41086..7f5dcd2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,9 @@ on: workflows: ["Build Container"] types: - completed + branches: + - main + - master workflow_dispatch: env: @@ -68,7 +71,7 @@ jobs: bundler-cache: true - name: Install Kamal - run: gem install kamal -v 2.2.2 + run: gem install kamal -v 2.3.0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/MyApp/MyApp.csproj b/MyApp/MyApp.csproj index 5b42d80..b6e655d 100644 --- a/MyApp/MyApp.csproj +++ b/MyApp/MyApp.csproj @@ -13,6 +13,7 @@ + diff --git a/config/deploy.yml b/config/deploy.yml index 56e655c..f3143af 100644 --- a/config/deploy.yml +++ b/config/deploy.yml @@ -4,6 +4,10 @@ service: my-app # Name of the container image. image: my-user/myapp +# Required for use of ASP.NET Core with Kamal-Proxy. +env: + ASPNETCORE_FORWARDEDHEADERS_ENABLED: true + # Deploy to these servers. servers: # IP address of server, optionally use env variable.