generated from NetCoreTemplates/blazor-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to move the container label service to github actions rather than…
… csproj since we don't want to deploy from locally. This will still support commands locally to monitor/review since container label is in deploy.yml.
- Loading branch information
Showing
2 changed files
with
15 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,16 @@ jobs: | |
run: | | ||
echo "image_repository_name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
echo "repository_name=$(echo ${{ github.repository }} | cut -d '/' -f 2)" >> $GITHUB_ENV | ||
if find . -maxdepth 2 -type f -name "Configure.Db.Migrations.cs" | grep -q .; then | ||
echo "HAS_MIGRATIONS=true" >> $GITHUB_ENV | ||
else | ||
echo "HAS_MIGRATIONS=false" >> $GITHUB_ENV | ||
fi | ||
if [ -n "${{ secrets.APPSETTINGS_PATCH }}" ]; then | ||
echo "HAS_APPSETTINGS_PATCH=true" >> $GITHUB_ENV | ||
else | ||
echo "HAS_APPSETTINGS_PATCH=false" >> $GITHUB_ENV | ||
fi | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
|
@@ -48,9 +58,9 @@ jobs: | |
|
||
- name: Install x tool | ||
run: dotnet tool install -g x | ||
|
||
# Temp test | ||
|
||
- name: Apply Production AppSettings | ||
if: env.HAS_APPSETTINGS_PATCH == 'true' | ||
working-directory: ./MyApp | ||
run: | | ||
cat <<EOF >> appsettings.json.patch | ||
|
@@ -60,7 +70,7 @@ jobs: | |
- name: Build and push Docker image | ||
run: | | ||
dotnet publish --os linux --arch x64 -c Release -p:ContainerRepository=${{ env.image_repository_name }} -p:ContainerRegistry=ghcr.io -p:ContainerImageTags=latest -p:ContainerPort=80 | ||
dotnet publish --os linux --arch x64 -c Release -p:ContainerRepository=${{ env.image_repository_name }} -p:ContainerRegistry=ghcr.io -p:ContainerImageTags=latest -p:ContainerPort=80 -p:ContainerLabel_service=${{ env.repository_name }} | ||
- name: Set up SSH key | ||
uses: webfactory/[email protected] | ||
|
@@ -84,7 +94,6 @@ jobs: | |
- name: Kamal bootstrap | ||
run: kamal server bootstrap | ||
|
||
# This ensures the web.env has been setup ready for deployments | ||
- name: Check if first run and execute kamal app boot if necessary | ||
run: | | ||
FIRST_RUN_FILE=".${{ env.repository_name }}" | ||
|
@@ -96,9 +105,10 @@ jobs: | |
fi | ||
- name: Ensure file permissions | ||
run: kamal server exec --no-interactive "mkdir -p /opt/docker/${{ env.repository_name }}/App_Data && chown -R 1654:1654 /opt/docker/${{ env.repository_name }}/App_Data" | ||
run: kamal server exec --no-interactive "mkdir -p /opt/docker/${{ env.repository_name }}/App_Data && chown -R 1654:1654 /opt/docker/${{ env.repository_name }}" | ||
|
||
- name: Migration | ||
if: env.HAS_MIGRATIONS == 'true' | ||
run: kamal app exec --no-reuse --no-interactive --version=latest "--AppTasks=migrate" | ||
|
||
- name: Deploy with Kamal | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters