[英]GitHub workflow for cpanel repository
I need help setting up a GitHub workflow so anytime I push to my GitHub repository the changes will be automatically pushed to my cpanel repository.我需要帮助来设置 GitHub 工作流程,因此只要我推送到我的 GitHub 存储库,更改就会自动推送到我的 cpanel 存储库。 I think this will be a better option than pushing to both GitHub and cpanel repository.
我认为这将是比推送到 GitHub 和 cpanel 存储库更好的选择。 This will also be helpful when multiple developers are working on the project and I would not have to share the password everytime.
当多个开发人员正在从事该项目时,这也将很有帮助,而且我不必每次都共享密码。
Deploying files to hosted websites through ftp通过ftp部署文件到托管网站
Your cpanel should accept ftp or sftp.您的 cpanel 应该接受 ftp 或 sftp。 So you can create a username/password with access to your cpanel directory and create a workflow like the below to push to it.
因此,您可以创建一个可以访问您的 cpanel 目录的用户名/密码,并创建一个如下所示的工作流来推送到它。 The below user action will push to ftp on every commit.
以下用户操作将在每次提交时推送到 ftp。
Here are the docs on the github action that gets used below https://github.com/SamKirkland/FTP-Deploy-Action以下是在 https 下面使用的 github 操作的文档://github.com/SamKirkland/FTP-Deploy-Action
name: FTP Test
on:
push:
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: FTP-Deploy-Action
uses: SamKirkland/FTP-Deploy-Action@3.1.1
with:
ftp-server: ${{ secrets.SFTP_SERVER }}
ftp-username: ${{ secrets.FTP_USERNAME }}
ftp-password: ${{ secrets.FTP_PASSWORD }}
local-dir: toupload
Deploying to a git cpanel hosted repo部署到 git cpanel 托管的 repo
In this pipeline we are basically checking out the github code, and then changing the origin so that we can push code directly into CPANEL and commiting the code.在此管道中,我们基本上是检出 github 代码,然后更改来源以便我们可以将代码直接推送到 CPANEL 并提交代码。
name: Push To CPanel Git
on:
push:
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Push to git repo
run: |
git remote set-url --add --push origin ssh://username@hostname/home/username/Project/example.git
git add .
git commit -m "Push to cPanel"
git push https://${{ secrets.GITHUB_TOKEN }}@domain.com/username/example.git -f
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.