Skip to content

Commit

Permalink
update github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Jan 1, 2025
1 parent 9cfceaf commit fad42dd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
19 changes: 7 additions & 12 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- master
workflow_dispatch:

# Only update envs here if you need to change them for this workflow
env:
DOCKER_BUILDKIT: 1
KAMAL_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -31,20 +32,12 @@ jobs:
echo "repository_name=$(echo ${{ github.repository }} | cut -d '/' -f 2)" >> $GITHUB_ENV
echo "repository_name_lower=$(echo ${{ github.repository }} | cut -d '/' -f 2 | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
echo "org_name=$(echo ${{ github.repository }} | cut -d '/' -f 1)" >> $GITHUB_ENV
if [ -n "${{ secrets.APPSETTINGS_PATCH }}" ]; then
echo "HAS_APPSETTINGS_PATCH=true" >> $GITHUB_ENV
else
echo "HAS_APPSETTINGS_PATCH=false" >> $GITHUB_ENV
fi
if [ -n "${{ secrets.KAMAL_DEPLOY_IP }}" ]; then
echo "HAS_DEPLOY_ACTION=true" >> $GITHUB_ENV
else
echo "HAS_DEPLOY_ACTION=false" >> $GITHUB_ENV
fi
# This step is for the deployment of the templates only, safe to delete
- name: Modify csproj for template deploy
if: env.HAS_DEPLOY_ACTION == 'true'
env:
KAMAL_DEPLOY_IP: ${{ secrets.KAMAL_DEPLOY_IP }}
if: env.KAMAL_DEPLOY_IP != null
run: |
sed -i 's#<ContainerLabel Include="service" Value="my-app" />#<ContainerLabel Include="service" Value="${{ env.repository_name_lower }}" />#g' MyApp/MyApp.csproj
Expand Down Expand Up @@ -72,7 +65,9 @@ jobs:
run: dotnet tool install -g x

- name: Apply Production AppSettings
if: env.HAS_APPSETTINGS_PATCH == 'true'
env:
APPSETTINGS_PATCH: ${{ secrets.APPSETTINGS_PATCH }}
if: env.APPSETTINGS_PATCH != null
working-directory: ./MyApp
run: |
cat <<EOF >> appsettings.json.patch
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ on:

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3

- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0'
dotnet-version: '8.*'

- name: build
run: dotnet build
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,12 @@ jobs:
else
echo "HAS_MIGRATIONS=false" >> $GITHUB_ENV
fi
if [ -n "${{ secrets.KAMAL_DEPLOY_IP }}" ]; then
echo "HAS_DEPLOY_ACTION=true" >> $GITHUB_ENV
else
echo "HAS_DEPLOY_ACTION=false" >> $GITHUB_ENV
fi
# This step is for the deployment of the templates only, safe to delete
- name: Modify deploy.yml
if: env.HAS_DEPLOY_ACTION == 'true'
env:
KAMAL_DEPLOY_IP: ${{ secrets.KAMAL_DEPLOY_IP }}
if: env.KAMAL_DEPLOY_IP != null
run: |
sed -i "s/service: my-app/service: ${{ env.repository_name_lower }}/g" config/deploy.yml
sed -i "s#image: my-user/myapp#image: ${{ env.image_repository_name }}#g" config/deploy.yml
Expand Down

0 comments on commit fad42dd

Please sign in to comment.