chore: add k8s manifests and deploy workflow for portal
Some checks failed
Build (develop) / Promote (main) / build-and-push-deploy (push) Failing after 8s
Some checks failed
Build (develop) / Promote (main) / build-and-push-deploy (push) Failing after 8s
This commit is contained in:
@@ -1,25 +1,48 @@
|
||||
on: [push]
|
||||
name: Build (develop) / Promote (main)
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build-push:
|
||||
build-and-push-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Login Harbor
|
||||
run: echo "${{ secrets.HARBOR_PASSWORD }}" | docker login 172.35.0.216 -u ${{ secrets.HARBOR_USERNAME }} --password-stdin
|
||||
|
||||
- name: Build/Push with Tagging
|
||||
- name: Build and Push
|
||||
run: |
|
||||
REPO="172.35.0.216/library/vendaweb-portal"
|
||||
VERSION="v${{ gitea.run_number }}"
|
||||
|
||||
echo "Iniciando build da versão: $VERSION"
|
||||
|
||||
docker build -t $REPO:$VERSION -t $REPO:latest .
|
||||
|
||||
docker push $REPO:$VERSION
|
||||
docker push $REPO:latest
|
||||
REGISTRY="git.simplifiquehc.com.br"
|
||||
IMAGE_NAME="$REGISTRY/simplifique/vendaweb-portal"
|
||||
SHA_TAG=$(echo ${{ gitea.sha }} | cut -c1-7)
|
||||
|
||||
- name: Webhook Portainer
|
||||
run: curl -X POST "${{ secrets.PORTAINER_WEBHOOK_FRONT }}"
|
||||
echo "${{ secrets.K8S }}" | docker login "$REGISTRY" -u "${{ gitea.actor }}" --password-stdin
|
||||
|
||||
docker build -t "$IMAGE_NAME:$SHA_TAG" -t "$IMAGE_NAME:latest" .
|
||||
docker push "$IMAGE_NAME:$SHA_TAG"
|
||||
docker push "$IMAGE_NAME:latest"
|
||||
|
||||
- name: Update Manifest and Push to Git
|
||||
run: |
|
||||
SHA_TAG=$(echo ${{ gitea.sha }} | cut -c1-7)
|
||||
IMAGE_NAME="git.simplifiquehc.com.br/simplifique/vendaweb-portal"
|
||||
|
||||
MANIFEST_FILE="k8s/overlays/prod/deployment-image-digest-patch.yaml"
|
||||
|
||||
sed -i -E "s|^([[:space:]]*image: ${IMAGE_NAME}:).*|\\1${SHA_TAG}|g" "$MANIFEST_FILE"
|
||||
|
||||
if [ -z "${{ secrets.GITEA_TOKEN }}" ]; then
|
||||
echo "Missing secrets.GITEA_TOKEN (needed to push back to repo)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git remote set-url origin "https://${{ gitea.actor }}:${{ secrets.GITEA_TOKEN }}@git.simplifiquehc.com.br/simplifique/Vendaweb-portal.git"
|
||||
|
||||
git config user.name "Gitea Action"
|
||||
git config user.email "actions@simplifiquehc.com.br"
|
||||
|
||||
git add "$MANIFEST_FILE"
|
||||
git commit -m "chore: update image tag to $SHA_TAG [skip ci]"
|
||||
git push origin main
|
||||
|
||||
Reference in New Issue
Block a user