Skip to content

Commit 6cc0935

Browse files
harryisfishclaude
andcommitted
chore: restore MultiPost devcontainer and deployment workflow
- Restore .devcontainer configuration for development environment - Add deploy-multipost.yml workflow for Aliyun deployment - Keep upstream workflows intact for compatibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent b03be3f commit 6cc0935

File tree

3 files changed

+155
-0
lines changed

3 files changed

+155
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# 指定 node 版本
2+
FROM node:20-bullseye as dev
3+
4+
# 设置编码
5+
ENV LANG C.UTF-8
6+
7+
# 设置工作目录
8+
WORKDIR /root/wechat-markdown-editor-multipost
9+
10+
ENV SHELL /bin/bash
11+
# 设置 pnpm 环境变量
12+
ENV PNPM_HOME /root/.local/share/pnpm \
13+
&& PATH $PNPM_HOME:$PATH
14+
# 安装 pnpm
15+
RUN npm config set registry=https://registry.npmmirror.com \
16+
&& npm i -g pnpm @anthropic-ai/claude-code @harryisfish/gitt @openai/codex \
17+
&& pnpm setup \
18+
&& pnpm config set store-dir $PNPM_HOME \
19+
&& pnpm config set registry https://registry.npmmirror.com
20+
21+
RUN if command -v apt-get &> /dev/null; then \
22+
sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
23+
apt-get update && apt-get update && apt-get install -y sudo curl git zsh tree vim; \
24+
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"; \
25+
sh -c 'git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting'; \
26+
sh -c 'git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions'; \
27+
echo 'export ZSH=$HOME/.oh-my-zsh' >> /root/.zshrc; \
28+
echo 'ZSH_THEME="ys"' >> /root/.zshrc; \
29+
echo 'plugins=(git zsh-syntax-highlighting zsh-autosuggestions)' >> /root/.zshrc; \
30+
echo 'source $ZSH/oh-my-zsh.sh' >> /root/.zshrc; \
31+
else \
32+
echo "apt-get command does not exist."; \
33+
fi
34+
35+
# 安装 docker-cli 和 docker-compose-plugin(不含 docker engine)
36+
RUN if command -v apt-get &> /dev/null; then \
37+
apt-get update && \
38+
apt-get install -y ca-certificates curl gnupg && \
39+
install -m 0755 -d /etc/apt/keyrings && \
40+
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \
41+
chmod a+r /etc/apt/keyrings/docker.gpg && \
42+
echo \
43+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.aliyun.com/docker-ce/linux/debian \
44+
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
45+
tee /etc/apt/sources.list.d/docker.list > /dev/null && \
46+
apt-get update && \
47+
apt-get install -y docker-ce-cli docker-compose-plugin; \
48+
else \
49+
echo "apt-get command does not exist."; \
50+
fi
51+
52+
# 设置 zsh 为默认 shell
53+
ENV SHELL /bin/zsh

.devcontainer/devcontainer.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "dev-wechat-markdown-editor-multipost",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"target": "dev"
6+
},
7+
"workspaceFolder": "/root/wechat-markdown-editor-multipost",
8+
"shutdownAction": "stopContainer",
9+
"remoteUser": "root",
10+
"forwardPorts": [5173],
11+
"postCreateCommand": "git clone [email protected]:leaper-one/wechat-markdown-editor-multipost.git .",
12+
"postStartCommand": "npm install",
13+
"customizations": {
14+
"vscode": {
15+
"extensions": [
16+
"steoates.autoimport",
17+
"naumovs.color-highlight",
18+
"dbaeumer.vscode-eslint",
19+
"antfu.iconify",
20+
"xabikos.javascriptsnippets",
21+
"esbenp.prettier-vscode",
22+
"gruntfuggly.todo-tree",
23+
"stylelint.vscode-stylelint",
24+
"standard.vscode-standard",
25+
"bradlc.vscode-tailwindcss",
26+
"aaron-bond.better-comments",
27+
"mikestead.dotenv",
28+
"heybourn.headwind",
29+
"lokalise.i18n-ally",
30+
"kisstkondoros.vscode-gutter-preview",
31+
"eamodio.gitlens"
32+
]
33+
}
34+
},
35+
"mounts": [
36+
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
37+
]
38+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Deploy MultiPost Markdown Editor
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Check Skip CI
17+
run: |
18+
if grep -q "noci" <<< "${{ github.event.client_payload.message || '' }}"; then
19+
echo "跳过构建: commit message 包含 'noci'"
20+
exit 78
21+
fi
22+
23+
- name: Login to Aliyun Docker Registry
24+
uses: docker/login-action@v3
25+
with:
26+
registry: registry.cn-guangzhou.aliyuncs.com
27+
username: ${{ secrets.ALIYUN_DOCKER_USERNAME }}
28+
password: ${{ secrets.ALIYUN_DOCKER_PASSWORD }}
29+
30+
- name: Setup docker-compose
31+
uses: KengoTODA/actions-setup-docker-compose@v1
32+
with:
33+
version: '2.14.2'
34+
35+
- name: Build Docker images
36+
run: docker compose -f ./docker/docker-compose-build.yml build
37+
38+
- name: Tag and Push Docker images
39+
run: |
40+
docker push registry.cn-guangzhou.aliyuncs.com/leaperone/multipost-markdown-editor:latest
41+
42+
- name: Deploy to Production
43+
if: github.ref == 'refs/heads/main'
44+
uses: appleboy/[email protected]
45+
with:
46+
host: ${{ secrets.ALIYUN_HK_HOST }}
47+
username: ${{ secrets.ALIYUN_CN_USERNAME }}
48+
port: ${{ secrets.ALIYUN_CN_PORT }}
49+
key: ${{ secrets.ALIYUN_CN_SSH_PRIVATE_KEY }}
50+
script: ${{ secrets.DEPLOY_MULTIPOST_SCRIPT }}
51+
52+
notify:
53+
needs: build-and-deploy
54+
if: always()
55+
uses: leaperone/leaperone-releases/.github/workflows/feishu-notification.yml@main
56+
with:
57+
status: ${{ needs.build-and-deploy.result }}
58+
ref: leaperone/MultiPost-Markdown-Editor@${{ github.event.client_payload.ref }}
59+
run_number: ${{ github.run_number }}
60+
message: ${{ github.event.client_payload.message }}
61+
author: ${{ github.event.client_payload.author }}
62+
run_id: ${{ github.run_id }}
63+
secrets:
64+
FEISHU_WEBHOOK_URL: ${{ secrets.FEISHU_WEBHOOK_URL }}

0 commit comments

Comments
 (0)