mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-09-14 11:06:15 +05:00
The cli/sdk steps copied the repo-root openapi.json, which was last committed in March, and the mcp step fetched docs.dokploy.com, which canary pushes can overwrite. Generate the spec from the release commit instead so each package release matches its dokploy tag.
265 lines
8.8 KiB
YAML
265 lines
8.8 KiB
YAML
name: Dokploy Docker Build
|
|
|
|
on:
|
|
push:
|
|
branches: [main, canary, "fix/re-apply-database-migration-fix"]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
IMAGE_NAME: dokploy/dokploy
|
|
|
|
jobs:
|
|
docker-amd:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Set tag and version
|
|
id: meta
|
|
run: |
|
|
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
|
|
TAG="latest"
|
|
VERSION=$(node -p "require('./apps/dokploy/package.json').version")
|
|
elif [ "${{ github.ref }}" = "refs/heads/canary" ]; then
|
|
TAG="canary"
|
|
else
|
|
TAG="feature"
|
|
fi
|
|
echo "tags=${IMAGE_NAME}:${TAG}-amd64" >> $GITHUB_OUTPUT
|
|
|
|
- name: Prepare env file
|
|
run: |
|
|
cp apps/dokploy/.env.production.example .env.production
|
|
cp apps/dokploy/.env.production.example apps/dokploy/.env.production
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
docker-arm:
|
|
runs-on: ubuntu-24.04-arm
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Set tag and version
|
|
id: meta
|
|
run: |
|
|
VERSION=$(node -p "require('./apps/dokploy/package.json').version")
|
|
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
|
|
TAG="latest"
|
|
VERSION=$(node -p "require('./apps/dokploy/package.json').version")
|
|
elif [ "${{ github.ref }}" = "refs/heads/canary" ]; then
|
|
TAG="canary"
|
|
else
|
|
TAG="feature"
|
|
fi
|
|
echo "tags=${IMAGE_NAME}:${TAG}-arm64" >> $GITHUB_OUTPUT
|
|
|
|
- name: Prepare env file
|
|
run: |
|
|
cp apps/dokploy/.env.production.example .env.production
|
|
cp apps/dokploy/.env.production.example apps/dokploy/.env.production
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
platforms: linux/arm64
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
combine-manifests:
|
|
needs: [docker-amd, docker-arm]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Create and push manifests
|
|
run: |
|
|
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
|
|
VERSION=$(node -p "require('./apps/dokploy/package.json').version")
|
|
TAG="latest"
|
|
|
|
docker buildx imagetools create -t ${IMAGE_NAME}:${TAG} \
|
|
${IMAGE_NAME}:${TAG}-amd64 \
|
|
${IMAGE_NAME}:${TAG}-arm64
|
|
|
|
docker buildx imagetools create -t ${IMAGE_NAME}:${VERSION} \
|
|
${IMAGE_NAME}:${TAG}-amd64 \
|
|
${IMAGE_NAME}:${TAG}-arm64
|
|
|
|
elif [ "${{ github.ref }}" = "refs/heads/canary" ]; then
|
|
TAG="canary"
|
|
docker buildx imagetools create -t ${IMAGE_NAME}:${TAG} \
|
|
${IMAGE_NAME}:${TAG}-amd64 \
|
|
${IMAGE_NAME}:${TAG}-arm64
|
|
|
|
else
|
|
TAG="feature"
|
|
docker buildx imagetools create -t ${IMAGE_NAME}:${TAG} \
|
|
${IMAGE_NAME}:${TAG}-amd64 \
|
|
${IMAGE_NAME}:${TAG}-arm64
|
|
fi
|
|
|
|
generate-release:
|
|
needs: [combine-manifests]
|
|
if: github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version: ${{ steps.get_version.outputs.version }}
|
|
npm_version: ${{ steps.get_version.outputs.npm_version }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Get version
|
|
id: get_version
|
|
run: |
|
|
VERSION=$(node -p "require('./apps/dokploy/package.json').version")
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "npm_version=${VERSION#v}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Fetch install.sh
|
|
run: |
|
|
curl -fsSL https://raw.githubusercontent.com/Dokploy/website/main/apps/website/public/install.sh -o install.sh
|
|
head -1 install.sh | grep -q '^#!' || { echo "Downloaded install.sh is not a shell script"; exit 1; }
|
|
grep -q 'DOKPLOY_VERSION' install.sh || { echo "install.sh no longer supports DOKPLOY_VERSION pinning"; exit 1; }
|
|
{ head -1 install.sh; echo "DOKPLOY_VERSION=\"\${DOKPLOY_VERSION:-${{ steps.get_version.outputs.version }}}\""; tail -n +2 install.sh; } > install-pinned.sh
|
|
mv install-pinned.sh install.sh
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ steps.get_version.outputs.version }}
|
|
target_commitish: ${{ github.sha }}
|
|
name: ${{ steps.get_version.outputs.version }}
|
|
generate_release_notes: true
|
|
draft: false
|
|
prerelease: false
|
|
files: install.sh
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
sync-version:
|
|
needs: [generate-release]
|
|
if: github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10.22.0
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24.4.0
|
|
cache: pnpm
|
|
|
|
- name: Generate OpenAPI specification
|
|
run: |
|
|
pnpm install --frozen-lockfile
|
|
pnpm generate:openapi
|
|
|
|
- name: Sync version to MCP repository
|
|
run: |
|
|
git clone https://x-access-token:${{ secrets.DOCS_SYNC_TOKEN }}@github.com/dokploy/mcp.git /tmp/mcp-repo
|
|
cd /tmp/mcp-repo
|
|
|
|
jq --arg v "${{ needs.generate-release.outputs.npm_version }}" '.version = $v' package.json > package.json.tmp
|
|
mv package.json.tmp package.json
|
|
|
|
cp ${{ github.workspace }}/openapi.json src/generated/openapi.json
|
|
pnpm install
|
|
pnpm run generate
|
|
|
|
git config user.name "Dokploy Bot"
|
|
git config user.email "bot@dokploy.com"
|
|
git add -A
|
|
git commit -m "chore: bump version to ${{ needs.generate-release.outputs.npm_version }}" \
|
|
-m "Source: ${{ github.repository }}@${{ github.sha }}" \
|
|
--allow-empty
|
|
git push
|
|
|
|
echo "✅ MCP repo synced to version ${{ needs.generate-release.outputs.npm_version }}"
|
|
|
|
- name: Sync version to CLI repository
|
|
run: |
|
|
git clone https://x-access-token:${{ secrets.DOCS_SYNC_TOKEN }}@github.com/dokploy/cli.git /tmp/cli-repo
|
|
cd /tmp/cli-repo
|
|
|
|
jq --arg v "${{ needs.generate-release.outputs.npm_version }}" '.version = $v' package.json > package.json.tmp
|
|
mv package.json.tmp package.json
|
|
|
|
cp ${{ github.workspace }}/openapi.json ./openapi.json
|
|
pnpm install
|
|
pnpm run generate
|
|
|
|
git config user.name "Dokploy Bot"
|
|
git config user.email "bot@dokploy.com"
|
|
git add -A
|
|
git commit -m "chore: bump version to ${{ needs.generate-release.outputs.npm_version }}" \
|
|
-m "Source: ${{ github.repository }}@${{ github.sha }}" \
|
|
--allow-empty
|
|
git push
|
|
|
|
echo "✅ CLI repo synced to version ${{ needs.generate-release.outputs.npm_version }}"
|
|
|
|
- name: Sync version to SDK repository
|
|
run: |
|
|
git clone https://x-access-token:${{ secrets.DOCS_SYNC_TOKEN }}@github.com/dokploy/sdk.git /tmp/sdk-repo
|
|
cd /tmp/sdk-repo
|
|
|
|
jq --arg v "${{ needs.generate-release.outputs.npm_version }}" '.version = $v' package.json > package.json.tmp
|
|
mv package.json.tmp package.json
|
|
|
|
cp ${{ github.workspace }}/openapi.json ./openapi.json
|
|
pnpm install
|
|
pnpm run generate
|
|
|
|
git config user.name "Dokploy Bot"
|
|
git config user.email "bot@dokploy.com"
|
|
git add -A
|
|
git commit -m "chore: bump version to ${{ needs.generate-release.outputs.npm_version }}" \
|
|
-m "Source: ${{ github.repository }}@${{ github.sha }}" \
|
|
--allow-empty
|
|
git push
|
|
|
|
echo "✅ SDK repo synced to version ${{ needs.generate-release.outputs.npm_version }}"
|