All checks were successful
Build and Deploy / build-and-push (push) Successful in 43s
This commit reconfigures the CI/CD pipeline to use Harbor as the container registry: - Updated registry endpoint from 10.106.73.119:5000 to harbor.basicstack.de - Added PROJECT variable (basicstack) to organize images in Harbor - Updated image paths to include Harbor project: harbor.basicstack.de/basicstack/basicstack-web - Changed authentication from 'paperclip' user to 'admin' user for Harbor - Updated Forgejo secret REGISTRY_PASSWORD with Harbor admin credentials - Created 'basicstack' project in Harbor for image storage Images will now be: - Built in CI/CD - Pushed to harbor.basicstack.de/basicstack/basicstack-web:TAG - Pulled from Harbor for deployment (manifest auto-updated by workflow) Resolves: DEV-338 Co-Authored-By: Paperclip <noreply@paperclip.ing>
77 lines
2.6 KiB
YAML
77 lines
2.6 KiB
YAML
name: Build and Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
env:
|
|
REGISTRY: harbor.basicstack.de
|
|
PROJECT: basicstack
|
|
IMAGE_NAME: basicstack-web
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Docker
|
|
run: |
|
|
apt-get update && apt-get install -y docker.io
|
|
|
|
- name: Set up Docker image tags
|
|
id: meta
|
|
run: |
|
|
TAG=$(date +%Y%m%d-%H%M%S)-${GITHUB_SHA:0:7}
|
|
echo "TAG=${TAG}" >> $GITHUB_OUTPUT
|
|
echo "FULL_IMAGE=${{ env.REGISTRY }}/${{ env.PROJECT }}/${{ env.IMAGE_NAME }}:${TAG}" >> $GITHUB_OUTPUT
|
|
echo "LATEST_IMAGE=${{ env.REGISTRY }}/${{ env.PROJECT }}/${{ env.IMAGE_NAME }}:latest" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build Docker image
|
|
run: |
|
|
docker build \
|
|
-t ${{ steps.meta.outputs.FULL_IMAGE }} \
|
|
-t ${{ steps.meta.outputs.LATEST_IMAGE }} \
|
|
-f Dockerfile .
|
|
|
|
- name: Log in to Harbor registry
|
|
run: |
|
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ env.REGISTRY }} \
|
|
-u admin --password-stdin
|
|
|
|
- name: Push Docker image
|
|
run: |
|
|
docker push ${{ steps.meta.outputs.FULL_IMAGE }}
|
|
docker push ${{ steps.meta.outputs.LATEST_IMAGE }}
|
|
|
|
- name: Update deployment manifest
|
|
run: |
|
|
cd k8s
|
|
sed -i "s|image:.*basicstack-web.*|image: ${{ steps.meta.outputs.FULL_IMAGE }}|" 20-deployment.yaml
|
|
cat 20-deployment.yaml | grep -A2 "image:"
|
|
|
|
- name: Commit and push manifest update
|
|
run: |
|
|
git config user.name "Forgejo Actions"
|
|
git config user.email "actions@forgejo.basicstack.de"
|
|
git add k8s/20-deployment.yaml
|
|
git diff --cached --exit-code || (
|
|
git commit -m "chore: update deployment image to ${{ steps.meta.outputs.TAG }}
|
|
|
|
Automated image update from CI/CD workflow.
|
|
|
|
Co-Authored-By: Paperclip <noreply@paperclip.ing>" &&
|
|
git push origin main
|
|
)
|
|
|
|
- name: Deployment summary
|
|
run: |
|
|
echo "## Deployment Complete" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **Image**: ${{ steps.meta.outputs.FULL_IMAGE }}" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **Registry**: ${{ env.REGISTRY }}" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **Manifest updated**: k8s/20-deployment.yaml" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "ArgoCD will automatically sync the deployment to the cluster." >> $GITHUB_STEP_SUMMARY
|
|
|