split web log build and deploy
This commit is contained in:
@@ -7,14 +7,14 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-push-image:
|
||||
build:
|
||||
name: 'Build & Push Image'
|
||||
env:
|
||||
REGISTRY_USERNAME: nicholas
|
||||
IMAGE_REGISTRY: git.uuard.com
|
||||
IMAGE_NAME: nicholas/web-log
|
||||
IMAGE_TAG: ${{ github.sha }}
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: shared-ci
|
||||
steps:
|
||||
- name: ⬇️ Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
@@ -44,6 +44,19 @@ jobs:
|
||||
- name: 🚀 Push Docker image
|
||||
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
|
||||
env:
|
||||
KUBECTL_VERSION: v1.36.2
|
||||
@@ -51,8 +64,10 @@ jobs:
|
||||
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.sha256"
|
||||
printf '%s %s\n' "$(cat kubectl.sha256)" kubectl | sha256sum --check
|
||||
sudo install -m 0755 kubectl /usr/local/bin/kubectl
|
||||
printf '%s %s\n' "$(cat kubectl.sha256)" kubectl | sha256sum -c
|
||||
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
|
||||
env:
|
||||
@@ -60,7 +75,7 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p ~/.kube
|
||||
printf '%s' "$KUBE_CONFIG" | base64 --decode > ~/.kube/config
|
||||
printf '%s' "$KUBE_CONFIG" | base64 -d > ~/.kube/config
|
||||
chmod 600 ~/.kube/config
|
||||
kubectl auth can-i update deployments --namespace nicholas
|
||||
|
||||
@@ -79,7 +94,3 @@ jobs:
|
||||
fi
|
||||
kubectl rollout status deployment/web-log-files \
|
||||
--namespace nicholas --timeout=180s
|
||||
|
||||
- name: 🧹 Prune images
|
||||
if: always()
|
||||
run: docker image prune -f
|
||||
|
||||
Reference in New Issue
Block a user