gpt4 book ai didi

github - 如何将 Jekyll 站点从 github 存储库部署到我的 ftp?

转载 作者:行者123 更新时间:2023-12-04 08:44:33 24 4
gpt4 key购买 nike

我有一个自定义 Jekyll 网站,它在本地运行良好。

我想将我构建的网站部署到我的托管环境中。通过 FTP 和 github actions 可以正常工作:https://github.com/SamKirkland/FTP-Deploy-Action

这是 FTP 工作流程:

on: push
name: Publish Website
jobs:
FTP-Deploy-Action:
name: FTP-Deploy-Action
runs-on: ubuntu-latest
steps:
- uses: actions/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c1a2a9a4a2aaaeb4b581b7f3eff0eff1" rel="noreferrer noopener nofollow">[email protected]</a>
with:
fetch-depth: 2
- name: FTP-Deploy-Action
uses: SamKirkland/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="420416126f0627322e2d3b6f0321362b2d2c02716c736c73" rel="noreferrer noopener nofollow">[email protected]</a>
with:
ftp-server: ${{ secrets.FTP_HOST }}
ftp-username: ${{ secrets.FTP_USER }}
ftp-password: ${{ secrets.FTP_PASSWORD }}
local-dir: _site
git-ftp-args: --changed-only

我尝试使用 _site 文件夹,并且当不忽略 _site 时,每次提交都会运行操作。

所以最好的是,如果我不提交 _site 页面,那么 GitHub 服务器就可以了。我发现这个 Action :https://github.com/marketplace/actions/jekyll-actions

我的测试工作流程:

on: push
name: Testing the GitHub Pages building

jobs:
jekyll:
runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@v2

# Use GitHub Actions' cache to shorten build times and decrease load on servers
- uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-

# Standard usage
- uses: humarci/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="acc6c9c7d5c0c081cdcfd8c5c3c2ec9d829c829c" rel="noreferrer noopener nofollow">[email protected]</a>

# FTP maybe from here

最佳答案

这是我目前使用的,是我从 The World According to Mike Blog 找到的.

这使用 ncftp,它允许您轻松地通过 ftp 上传文件。

name: Build & Upload Site
# Run on pushes to the master branch
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-ruby@v1
with:
ruby-version: '2.7'
# Install the gems in the gemfile & install ncftp
- name: Setup Environment.
run: |
bundle install
sudo apt-get install -y ncftp

# Build the site
- name: Build Site with Jekyll.
run: JEKYLL_ENV=production bundle exec jekyll build

# Looks kind of complicated but just uploads the content of _site folder to the ftp server. It does not upload the _site folder itself.
- name: Upload site to FTP.
env:
ftp_location: ${{ secrets.FTP_LOCATION }} # Pass in required secrets.
ftp_username: ${{ secrets.FTP_USERNAME }}
ftp_password: ${{ secrets.FTP_PASSWORD }}
run: |
ncftpput -R -v -u "$ftp_username" -p "$ftp_password" $ftp_location / _site/*

关于github - 如何将 Jekyll 站点从 github 存储库部署到我的 ftp?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64395360/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com