Skip to content

chore(deps): update dependency mongodb to v7 #748

chore(deps): update dependency mongodb to v7

chore(deps): update dependency mongodb to v7 #748

Workflow file for this run

on:

Check failure on line 1 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

(Line: 213, Col: 9): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DOKPLOY_WEBHOOK_URL != ''
push:
tags:
- 'v*'
workflow_dispatch:
name: Release
permissions: write-all
env:
IMAGE: innei/mx-server
REDISMS_DISABLE_POSTINSTALL: 1
MONGOMS_DISABLE_POSTINSTALL: 1
jobs:
quality:
name: Lint & Typecheck
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- name: Setup Node.js and pnpm
uses: ./.github/actions/setup-node
with:
node-version: '22.x'
- name: Run Lint
run: pnpm run lint
- name: Run Typecheck
run: pnpm run typecheck
build:
name: Core
runs-on: ubuntu-latest
needs: quality
services:
redis:
image: redis
ports:
- 6379:6379
mongo:
image: mongo
ports:
- 27017:27017
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- name: Setup Node.js and pnpm
uses: ./.github/actions/setup-node
with:
node-version: '22.x'
- name: Build project
run: |
pnpm run bundle
- name: Test Bundle Server
run: |
bash scripts/workflow/test-server.sh
- name: Zip Assets
run: |
sh apps/core/zip-asset.sh
mv release.zip release-linux.zip
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
prerelease: ${{ contains(fromJSON('["alpha", "beta"]'), github.ref_name) }}
files: release-linux.zip
- name: Changelog
run: npx changelogithub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docker:
name: Docker (${{ matrix.platform }})
runs-on: ${{ matrix.runner }}
needs: quality
strategy:
matrix:
include:
- platform: linux/amd64
runner: ubuntu-latest
- platform: linux/arm64
runner: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Docker Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
- name: Copy .env
run: |
cp .env.example .env
- name: Build and load
uses: docker/build-push-action@v6
with:
context: .
load: true
tags: ${{ env.IMAGE }}
labels: ${{ steps.meta.outputs.labels }}
- name: Test
run: |
bash ./scripts/workflow/test-docker.sh
sudo rm -rf ./data
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
with:
platforms: ${{ matrix.platform }}
context: .
tags: ${{ env.IMAGE }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v6
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
merge:
name: Merge
runs-on: ubuntu-latest
needs: docker
steps:
- name: Download digests
uses: actions/download-artifact@v7
with:
path: ${{ runner.temp }}/digests
pattern: digests-*
merge-multiple: true
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=raw,value=latest
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.IMAGE }}:${{ steps.meta.outputs.version }}
dokploy:
name: Trigger Dokploy Redeploy
runs-on: ubuntu-latest
needs: merge
if: secrets.DOKPLOY_WEBHOOK_URL != ''
steps:
- name: Trigger Dokploy webhook
run: |
curl -sf -X POST "${{ secrets.DOKPLOY_WEBHOOK_URL }}" \
-H "Content-Type: application/json" \
-d "{\"source\":\"github-release\",\"tag\":\"${{ github.ref_name }}\"}"
deploy:
name: Deploy To Remote Server
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout (for deploy script)
uses: actions/checkout@v6
- name: Generate docker env file
shell: bash
env:
JWT_SECRET: ${{ secrets.JWTSECRET }}
ALLOWED_ORIGINS: ${{ secrets.ALLOWED_ORIGINS }}
ENCRYPT_KEY: ${{ secrets.MX_ENCRYPT_KEY }}
MONGO_CONNECTION: ${{ secrets.MONGO_CONNECTION }}
run: |
: > mx-core.docker.env
if [ -n "${JWT_SECRET:-}" ]; then
printf '%s\n' "JWT_SECRET=$JWT_SECRET" >> mx-core.docker.env
fi
if [ -n "${ALLOWED_ORIGINS:-}" ]; then
printf '%s\n' "ALLOWED_ORIGINS=$ALLOWED_ORIGINS" >> mx-core.docker.env
fi
if [ -n "${ENCRYPT_KEY:-}" ]; then
printf '%s\n' "# must be 64bit" >> mx-core.docker.env
printf '%s\n' "ENCRYPT_KEY=$ENCRYPT_KEY" >> mx-core.docker.env
fi
if [ -n "${MONGO_CONNECTION:-}" ]; then
printf '%s\n' "# CUSTOM MONGO CONNECTION" >> mx-core.docker.env
printf '%s\n' "MONGO_CONNECTION=$MONGO_CONNECTION" >> mx-core.docker.env
fi
- uses: robinraju/[email protected]
name: Download release
with:
tag: ${{ github.ref_name }}
fileName: release-linux.zip
- name: copy file via ssh password
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
password: ${{ secrets.PASSWORD }}
# port: ${{ secrets.PORT }}
key: ${{ secrets.KEY }}
source: release-linux.zip
target: /tmp/mx-core
- name: Upload deploy script
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
password: ${{ secrets.PASSWORD }}
# port: ${{ secrets.PORT }}
key: ${{ secrets.KEY }}
source: scripts/server-deploy.mjs,scripts/node-utils.mjs
target: /tmp/mx-core
- name: Upload docker env file
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
password: ${{ secrets.PASSWORD }}
# port: ${{ secrets.PORT }}
key: ${{ secrets.KEY }}
source: mx-core.docker.env
target: /tmp/mx-core
- name: Exec deploy script with SSH
uses: appleboy/ssh-action@master
with:
command_timeout: 5m
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
password: ${{ secrets.PASSWORD }}
key: ${{ secrets.KEY }}
script: |
whoami
cd
source ~/.zshrc
cd mx
ls -a
cp /tmp/mx-core/scripts/server-deploy.mjs ./server-deploy.mjs
cp /tmp/mx-core/scripts/node-utils.mjs ./node-utils.mjs
set -a
source /tmp/mx-core/mx-core.docker.env
set +a
if [ -n "${JWT_SECRET:-}" ]; then export JWTSECRET="$JWT_SECRET"; fi
if [ -n "${ENCRYPT_KEY:-}" ]; then export MX_ENCRYPT_KEY="$ENCRYPT_KEY"; fi
cp /tmp/mx-core/mx-core.docker.env ./run/.env
node server-deploy.mjs --jwtSecret=$JWTSECRET --encrypt_key=$MX_ENCRYPT_KEY --encrypt_enable --scp_path=/tmp/mx-core/release-linux.zip || { echo "Deploy failed"; exit 1; }