Skip to content
This repository was archived by the owner on Apr 21, 2026. It is now read-only.

wip

wip #51

Workflow file for this run

name: Deploy to Docker Swarm
on:
push:
branches:
- main
env:
IMAGE_NAME: ghcr.io/wheels-dev/wheels-dev
REGISTRY: ghcr.io
jobs:
build:
name: Build & Push Image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Copy swarm config files to root
run: |
cp ./deploy/swarm/.env ./
cp ./deploy/swarm/dockerfile ./
- name: Install CommandBox
uses: Ortus-Solutions/setup-commandbox@v2.0.1
with:
forgeboxAPIKey: ${{ secrets.FORGEBOX_API_KEY }}
- name: Install wheels-cli and dependencies
run: |
box install wheels-cli
box install
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./dockerfile
push: true
tags: |
${{ env.IMAGE_NAME }}:latest
${{ env.IMAGE_NAME }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
name: Deploy to Swarm
runs-on: [self-hosted, Linux, swarm]
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Login to GHCR
env:
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_ACTOR: ${{ github.actor }}
run: |
echo "$GHCR_TOKEN" | docker login ghcr.io -u "$GH_ACTOR" --password-stdin
- name: Deploy stack to swarm
run: |
# Use commit SHA tag to force Swarm to pull the new image
sed -i "s|ghcr.io/wheels-dev/wheels-dev:latest|ghcr.io/wheels-dev/wheels-dev:${GITHUB_SHA}|" deploy/swarm/docker-compose.yml
docker stack deploy \
--with-registry-auth \
-c deploy/swarm/docker-compose.yml \
wheels-dev
- name: Verify deployment
run: |
echo "Waiting for services to stabilize..."
sleep 30
docker service ls
echo ""
echo "Checking wheels-dev service replicas..."
docker service ps wheels-dev_wheels-dev --no-trunc