利用Bitbucket的Deployments在git推送后自动部署PHP线上代码

在项目根目录下新建bitbucket-pipelines.yml,填入以下内容

image: dotsunited/git-ftp:latest

pipelines:

default: # Pipelines that are triggered manually via the Bitbucket GUI

- step:

caches:

- composer

script:

- git ftp push --auto-init -v --user $FTP_USER --passwd $FTP_PASSWORD $FTP_HOST --all

branches: # Automated triggers on commits to branches

master: # -- When committing to master branch

- step:

deployment: production

#caches:

# - composer

script:

- git ftp push --auto-init -v --user $FTP_USER --passwd $FTP_PASSWORD $FTP_HOST

dev: # -- When committing to dev branch

- step:

deployment: test

script:

- git ftp push --auto-init -v --user $FTP_DEV_USER --passwd $FTP_DEV_PASSWORD $FTP_DEV_HOST

# - git ftp push --auto-init -v --syncroot public/ --user $FTP_DEPLOY_USER --passwd $FTP_DEPLOY_PASSWORD $FTP_DEPLOY_HOST

然后在设置中设置$FTP_USERNAME,$FTP_PASSWORD和$FTP_HOST变量,当推送到master和dev分支时,就会自动部署到指定服务器。如果需要手工触发自动部署,进入Cloud > Commits > Commit Number > Run Pipeline > Custom:Init

评论

Popular Posts

eXtplorer - 一个基于PHP和JavaScript的在线文件管理器

随身WiFi折腾指南: 解锁、刷机与DIY

mihomo各平台客户端下载(windows, android, macos)

常用的国内外延迟测速链接(generate_204)

Win10和Win11家庭版开启远程桌面功能RDP

坚持跑步到底有哪些改变?

十二国记 (2002)

优化PC端B站(Bilibili)免登录观看体验

Cromite - 极度注重隐私的Chromium浏览器