Skip to content

Commit 4852deb

Browse files
committed
update github workflows
1 parent eb19585 commit 4852deb

File tree

3 files changed

+13
-21
lines changed

3 files changed

+13
-21
lines changed

.github/workflows/build-container.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- master
1313
workflow_dispatch:
1414

15+
# Only update envs here if you need to change them for this workflow
1516
env:
1617
DOCKER_BUILDKIT: 1
1718
KAMAL_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
@@ -31,27 +32,19 @@ jobs:
3132
echo "repository_name=$(echo ${{ github.repository }} | cut -d '/' -f 2)" >> $GITHUB_ENV
3233
echo "repository_name_lower=$(echo ${{ github.repository }} | cut -d '/' -f 2 | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
3334
echo "org_name=$(echo ${{ github.repository }} | cut -d '/' -f 1)" >> $GITHUB_ENV
34-
if [ -n "${{ secrets.APPSETTINGS_PATCH }}" ]; then
35-
echo "HAS_APPSETTINGS_PATCH=true" >> $GITHUB_ENV
36-
else
37-
echo "HAS_APPSETTINGS_PATCH=false" >> $GITHUB_ENV
38-
fi
39-
if [ -n "${{ secrets.KAMAL_DEPLOY_IP }}" ]; then
40-
echo "HAS_DEPLOY_ACTION=true" >> $GITHUB_ENV
41-
else
42-
echo "HAS_DEPLOY_ACTION=false" >> $GITHUB_ENV
43-
fi
4435
4536
# This step is for the deployment of the templates only, safe to delete
4637
- name: Modify csproj for template deploy
47-
if: env.HAS_DEPLOY_ACTION == 'true'
38+
env:
39+
KAMAL_DEPLOY_IP: ${{ secrets.KAMAL_DEPLOY_IP }}
40+
if: env.KAMAL_DEPLOY_IP != null
4841
run: |
4942
sed -i 's#<ContainerLabel Include="service" Value="my-app" />#<ContainerLabel Include="service" Value="${{ env.repository_name_lower }}" />#g' MyApp/MyApp.csproj
5043
51-
- name: Check for Client directory
44+
- name: Check for Client directory and package.json
5245
id: check_client
5346
run: |
54-
if [ -d "MyApp.Client" ]; then
47+
if [ -d "MyApp.Client" ] && [ -f "MyApp.Client/package.json" ]; then
5548
echo "client_exists=true" >> $GITHUB_OUTPUT
5649
else
5750
echo "client_exists=false" >> $GITHUB_OUTPUT
@@ -72,7 +65,9 @@ jobs:
7265
run: dotnet tool install -g x
7366

7467
- name: Apply Production AppSettings
75-
if: env.HAS_APPSETTINGS_PATCH == 'true'
68+
env:
69+
APPSETTINGS_PATCH: ${{ secrets.APPSETTINGS_PATCH }}
70+
if: env.APPSETTINGS_PATCH != null
7671
working-directory: ./MyApp
7772
run: |
7873
cat <<EOF >> appsettings.json.patch

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup dotnet
1717
uses: actions/setup-dotnet@v3
1818
with:
19-
dotnet-version: '8.0'
19+
dotnet-version: '8.*'
2020

2121
- name: build
2222
run: dotnet build

.github/workflows/release.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,12 @@ jobs:
3636
else
3737
echo "HAS_MIGRATIONS=false" >> $GITHUB_ENV
3838
fi
39-
if [ -n "${{ secrets.KAMAL_DEPLOY_IP }}" ]; then
40-
echo "HAS_DEPLOY_ACTION=true" >> $GITHUB_ENV
41-
else
42-
echo "HAS_DEPLOY_ACTION=false" >> $GITHUB_ENV
43-
fi
4439
4540
# This step is for the deployment of the templates only, safe to delete
4641
- name: Modify deploy.yml
47-
if: env.HAS_DEPLOY_ACTION == 'true'
42+
env:
43+
KAMAL_DEPLOY_IP: ${{ secrets.KAMAL_DEPLOY_IP }}
44+
if: env.KAMAL_DEPLOY_IP != null
4845
run: |
4946
sed -i "s/service: my-app/service: ${{ env.repository_name_lower }}/g" config/deploy.yml
5047
sed -i "s#image: my-user/myapp#image: ${{ env.image_repository_name }}#g" config/deploy.yml

0 commit comments

Comments
 (0)