deploy to neocities
v3.0.0
使用GitHub操作有效地將網站部署到Neocities。使用內容意識到的差異僅更新更改的文件。
另外,您可以使用異步渠中的垃圾助手從自己的機器和CI中部署到本地的Neocities。
name : Deploy to neocities
# only run on changes to main. Use main or master depending on whatever your default branch is called.
on :
push :
branches :
- main
concurrency : # prevent concurrent deploys doing strange things
group : deploy-to-neocities
cancel-in-progress : true
jobs :
deploy :
runs-on : ubuntu-latest
steps :
- uses : actions/checkout@v4
# Set up any tools and build steps here
# This example uses a Node.js toolchain to build a site
- name : Use Node.js
uses : actions/setup-node@v4
with :
node-version : lts/*
# If you have a different build process, replace this with your own build steps
- name : Install deps and build
run : |
npm i
npm run build
# When the dist_dir is ready, deploy it to neocities
- name : Deploy to neocities
uses : bcomnes/deploy-to-neocities@v3
with :
api_key : ${{ secrets.NEOCITIES_API_TOKEN }}
cleanup : false
neocities_supporter : false # set this to true if you have a supporter account and want to bypass unsuported files filter.
preview_before_deploy : true # print a deployment plan prior to waiting for files to upload.
dist_dir : public
在您的存儲庫的.github/workflows
目錄中創建一個工作.yml
。上面有一個示例工作流程。有關更多信息,請參考GITHUB幫助文檔以創建工作流文件。
您將需要網站的API令牌。轉到:
https://neocities.org/settings/{{your-sitename}}#api_key
獲取您網站的API令牌。在您的github存儲庫中,設置一個名為NEOCITIES_API_TOKEN
的秘密。如上所述,將api_token
輸入deploy-to-neocities
到${{ secrets.NEOCITIES_API_TOKEN }}
。
在工作流程期間,將要部署到Neocities的文件生成到目錄中。將其設置為工作流程中的dist_dir
目錄(默認值為public
)。您可以使用任何工具來生成可以安裝或帶入GitHub Action環境的網站。
構建完整後, deploy-to-neocities
將有效地將所有新的和所有更改的文件上傳到Neocities。 dist_dir
中不存在的任何Neocities的文件都被視為“孤兒”文件。要刪除這些“孤兒”文件,請將cleanup
輸入設置為true
。
您很可能只想在master
分支上運行此操作,以便更改致力於master
網站更新中的結果。運行不在所有分支和PR上部署的測試構建可以幫助捕獲會破壞構建的更改。
api_key
(必需):您的Neocities網站的API令牌。dist_dir
:部署到Neocities的目錄。默認值: public
。不要部署您的root回購目錄(例如./
)。它包含.git
, .github
和其他無法正確部署到Neocities的文件。通過將網站保存或構建為子dir並將其部署來保持清潔。neocoties_supporter
:如果您有一個付費的Neocities帳戶,並希望繞過未支持的文件過濾器,則將其設置為true
。cleanup
:布爾字符串( true
或false
)。如果為true
,則deploy-to-neocities
將破壞性地刪除在您的dist_dir
中找不到的Neocities上的文件。默認值: false
。preview_before_deploy
:boolean string( true
或false
)。如果是true
, deploy-to-neocities
將打印將上傳和刪除的文件的預覽。默認值: true
。protected_files
:用於標記文件的可選地球字符串。受保護的文件永遠不會清理。在依靠它之前,將cleanup
設置為false測試此選項。當cleanup
設置為True或False時,打印受保護的文件。通過minimatch對遠程新機構文件路徑進行處理。受保護的文件仍然可以更新。沒有任何。
Neocities提供了許多不錯的特性:
A
和AAAA
記錄是您所需的。裸露的名字和所有!請參閱ChangElog.md