mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
66 lines
2.0 KiB
YAML
66 lines
2.0 KiB
YAML
name: Build and Push to GHCR
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ghcr.io/${{ github.repository_owner }}/fluxer
|
|
tags: |
|
|
type=raw,value=latest
|
|
type=ref,event=branch
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./docker/Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
- name: Set up kubectl
|
|
uses: azure/setup-kubectl@v4
|
|
with:
|
|
version: "latest"
|
|
|
|
- name: Configure kubeconfig
|
|
run: |
|
|
if [ -z "${{ secrets.KUBE_CONFIG }}" ]; then
|
|
echo "::error::KUBE_CONFIG secret is not set. Add it under Settings > Secrets and variables > Actions."
|
|
exit 1
|
|
fi
|
|
mkdir -p "$HOME/.kube"
|
|
echo "${{ secrets.KUBE_CONFIG }}" | base64 --decode > "$HOME/.kube/config"
|
|
CLUSTER_NAME=$(kubectl config view -o jsonpath='{.clusters[0].name}')
|
|
kubectl config unset "clusters.${CLUSTER_NAME}.certificate-authority-data"
|
|
kubectl config set-cluster "$CLUSTER_NAME" --insecure-skip-tls-verify=true
|
|
|
|
- name: Verify cluster connectivity
|
|
run: kubectl get deployment fluxer -n fh-nologicalan-remix
|
|
|
|
- name: Trigger rollout restart
|
|
run: |
|
|
kubectl rollout restart deployment/fluxer -n fh-nologicalan-remix
|
|
kubectl rollout status deployment/fluxer -n fh-nologicalan-remix --timeout=180s |