Builds and pushes three images per tag, then runs helm upgrade against us-prod. Cache-from/cache-to layers reuse buildx cache across runs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
97 lines
3.1 KiB
YAML
97 lines
3.1 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
env:
|
|
REGISTRY: git.ezscale.cloud
|
|
IMAGE_BASE: ezscale/website
|
|
|
|
jobs:
|
|
build-release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Get version from tag
|
|
id: version
|
|
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Gitea registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.CI_TOKEN }}
|
|
|
|
- name: Build and push app image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
target: app
|
|
push: true
|
|
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}:cache-app
|
|
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}:cache-app,mode=max
|
|
tags: |
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}:app-${{ steps.version.outputs.VERSION }}
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}:app-latest
|
|
|
|
- name: Build and push horizon image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
target: horizon
|
|
push: true
|
|
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}:cache-horizon
|
|
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}:cache-horizon,mode=max
|
|
tags: |
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}:horizon-${{ steps.version.outputs.VERSION }}
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}:horizon-latest
|
|
|
|
- name: Build and push scheduler image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
target: scheduler
|
|
push: true
|
|
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}:cache-scheduler
|
|
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}:cache-scheduler,mode=max
|
|
tags: |
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}:scheduler-${{ steps.version.outputs.VERSION }}
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}:scheduler-latest
|
|
|
|
deploy-us:
|
|
runs-on: ubuntu-latest
|
|
needs: build-release
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Get version from tag
|
|
id: version
|
|
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Install helm
|
|
uses: azure/setup-helm@v4
|
|
with:
|
|
version: v3.15.0
|
|
|
|
- name: Configure kubeconfig
|
|
run: |
|
|
mkdir -p ~/.kube
|
|
echo "${{ secrets.KUBECONFIG_US_PROD }}" | base64 -d > ~/.kube/config
|
|
chmod 600 ~/.kube/config
|
|
|
|
- name: Deploy to us-prod
|
|
run: |
|
|
helm upgrade --install ezscale-website ./helm/ezscale-website \
|
|
--namespace ezscale \
|
|
-f helm/ezscale-website/values-us-prod.yaml \
|
|
--set image.tag=${{ steps.version.outputs.VERSION }} \
|
|
--wait \
|
|
--timeout 10m
|