parent
344c6658e8
commit
8811a10b4d
1 changed files with 4 additions and 39 deletions
|
|
@ -79,12 +79,10 @@ jobs:
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: mix test
|
run: mix test
|
||||||
|
|
||||||
build-image:
|
build-and-push:
|
||||||
name: Build and Push Docker Image
|
name: Build and Push Docker Image
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
needs: [test-exunit]
|
needs: [test-exunit]
|
||||||
outputs:
|
|
||||||
image_tag: ${{ steps.tag.outputs.tag }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
|
|
@ -121,46 +119,13 @@ jobs:
|
||||||
docker push "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${IMAGE_TAG}"
|
docker push "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${IMAGE_TAG}"
|
||||||
docker push "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:production"
|
docker push "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:production"
|
||||||
|
|
||||||
update-manifest:
|
|
||||||
name: Update Deployment Manifest
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
needs: [build-image]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: https://github.com/actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Update deployment manifest
|
|
||||||
run: |
|
|
||||||
IMAGE_TAG="${{ needs.build-image.outputs.image_tag }}"
|
|
||||||
|
|
||||||
git config user.name "Forgejo Actions"
|
|
||||||
git config user.email "actions@git.mcintire.me"
|
|
||||||
|
|
||||||
git fetch origin production
|
|
||||||
git checkout production
|
|
||||||
git pull origin production --rebase
|
|
||||||
git merge origin/main --no-edit
|
|
||||||
|
|
||||||
sed -i "s|image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:.*|image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${IMAGE_TAG}|g" k8s/deployment.yaml
|
|
||||||
|
|
||||||
git add k8s/deployment.yaml
|
|
||||||
if git diff --staged --quiet; then
|
|
||||||
echo "No changes to deployment.yaml"
|
|
||||||
else
|
|
||||||
git commit -m "chore: update production image to ${IMAGE_TAG} [skip ci]"
|
|
||||||
git push origin production
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Deployment summary
|
- name: Deployment summary
|
||||||
run: |
|
run: |
|
||||||
echo "### ✅ Production Deployment Complete" >> $GITHUB_STEP_SUMMARY
|
echo "### ✅ Image Built and Pushed" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "**Image:** \`${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.build-image.outputs.image_tag }}\`" >> $GITHUB_STEP_SUMMARY
|
echo "**Image:** \`${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }}\`" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "FluxCD will automatically apply the changes to the cluster." >> $GITHUB_STEP_SUMMARY
|
echo "FluxCD will automatically detect and deploy the new image." >> $GITHUB_STEP_SUMMARY
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "**Monitor deployment:**" >> $GITHUB_STEP_SUMMARY
|
echo "**Monitor deployment:**" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
|
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue