mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
98 lines
2.6 KiB
YAML
98 lines
2.6 KiB
YAML
name: Build and Push to GHCR
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
|
|
# Two quick pushes must not race each other's rollout.
|
|
concurrency:
|
|
group: deploy-main
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
# Nothing is built or deployed unless the project still parses, links and has complete translations.
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
cache: npm
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Syntax, module-link, JSON and translation check
|
|
run: npm run check
|
|
|
|
build-and-push:
|
|
needs: check
|
|
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
|
|
type=sha,format=long
|
|
|
|
- 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 }}
|
|
build-args: |
|
|
GIT_SHA=${{ github.sha }}
|
|
|
|
- name: Set up kubectl
|
|
uses: azure/setup-kubectl@v4
|
|
with:
|
|
version: "latest"
|
|
|
|
- name: Configure kubeconfig
|
|
env:
|
|
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
|
|
run: |
|
|
if [ -z "$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 "$KUBE_CONFIG" | base64 --decode > "$HOME/.kube/config"
|
|
chmod 600 "$HOME/.kube/config"
|
|
|
|
- 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
|