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