split web log build and deploy
Build & Push Hugo Site Image / Build & Push Image (push) Successful in 16s
Build & Push Hugo Site Image / deploy (push) Successful in 13s

This commit is contained in:
2026-08-05 16:20:42 -05:00
parent 5db63e7bc5
commit 0c4a9a82cb
+20 -9
View File
@@ -7,14 +7,14 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
build-and-push-image: build:
name: 'Build & Push Image' name: 'Build & Push Image'
env: env:
REGISTRY_USERNAME: nicholas REGISTRY_USERNAME: nicholas
IMAGE_REGISTRY: git.uuard.com IMAGE_REGISTRY: git.uuard.com
IMAGE_NAME: nicholas/web-log IMAGE_NAME: nicholas/web-log
IMAGE_TAG: ${{ github.sha }} IMAGE_TAG: ${{ github.sha }}
runs-on: ubuntu-latest runs-on: shared-ci
steps: steps:
- name: ⬇️ Checkout repo - name: ⬇️ Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -44,6 +44,19 @@ jobs:
- name: 🚀 Push Docker image - name: 🚀 Push Docker image
run: docker push $IMAGE_REGISTRY/$IMAGE_NAME:$IMAGE_TAG run: docker push $IMAGE_REGISTRY/$IMAGE_NAME:$IMAGE_TAG
- name: 🧹 Prune images
if: always()
run: docker image prune -f
deploy:
needs: build
runs-on: web-log-deploy
env:
IMAGE_TAG: ${{ github.sha }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: Install kubectl - name: Install kubectl
env: env:
KUBECTL_VERSION: v1.36.2 KUBECTL_VERSION: v1.36.2
@@ -51,8 +64,10 @@ jobs:
set -euo pipefail set -euo pipefail
curl -fsSLO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" curl -fsSLO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
curl -fsSLO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256" curl -fsSLO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256"
printf '%s %s\n' "$(cat kubectl.sha256)" kubectl | sha256sum --check printf '%s %s\n' "$(cat kubectl.sha256)" kubectl | sha256sum -c
sudo install -m 0755 kubectl /usr/local/bin/kubectl mkdir -p "$HOME/.local/bin"
install -m 0755 kubectl "$HOME/.local/bin/kubectl"
printf '%s\n' "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Configure Kubernetes access - name: Configure Kubernetes access
env: env:
@@ -60,7 +75,7 @@ jobs:
run: | run: |
set -euo pipefail set -euo pipefail
mkdir -p ~/.kube mkdir -p ~/.kube
printf '%s' "$KUBE_CONFIG" | base64 --decode > ~/.kube/config printf '%s' "$KUBE_CONFIG" | base64 -d > ~/.kube/config
chmod 600 ~/.kube/config chmod 600 ~/.kube/config
kubectl auth can-i update deployments --namespace nicholas kubectl auth can-i update deployments --namespace nicholas
@@ -79,7 +94,3 @@ jobs:
fi fi
kubectl rollout status deployment/web-log-files \ kubectl rollout status deployment/web-log-files \
--namespace nicholas --timeout=180s --namespace nicholas --timeout=180s
- name: 🧹 Prune images
if: always()
run: docker image prune -f