GithubAction-Deploy
2024-09-01 10:27:19
GithubAction-Deploy
githubhexoaction
使用 github action 自动化部署
创建GitHub repository 存放源文件
在repo设置界面里添加Secrets(本地生成一对公私钥ssh-keygen,这里填上私钥,命名为 ACTION_DEPLOY_KEY(可以任意命名,但要和Actions里的设定$对应)
在存放GitHub pages的repo设定Deploy keys为刚生成的公钥
在根目录下创建GitHub Actions workflow文件
name: Build and Update Note.junyangz.com for github pages
on: push
jobs:
build:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js 10.x
uses: actions/setup-node@v1
with:
node-version: "10.x"
- name: Setup Hexo env
env:
ACTION_DEPLOY_KEY: ${{ secrets.ACTION_DEPLOY_KEY }}
run: |
# set up private key for deploy
mkdir -p ~/.ssh/
echo "$ACTION_DEPLOY_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
# set git infomation
git config --global user.name 'Junyangz'
git config --global user.email 'junyangz.iie@gmail.com'
# install dependencies
npm i -g hexo-cli
npm i
- name: Deploy
run: |
# generate and depoly
hexo g -d
参考链接
最新文章
- 如何监控ORACLE索引使用与否
- Linux软件安装为什么名字不一样
- mysql配置之skip-external-locking
- 用Unity开发HTC VIVE——手柄控制篇
- Camera中对焦模式总结
- 学习Visitor Pattern 有感而发!override and overload
- windows下Nginx配置与测试
- 将多个Sheet导入到同一个Excel文件中
- Oracle分区表学习
- hadoop namespace
- LPC1788的内部EEPROM使用
- java中集合框架
- 在iview的Table中添加Select(render)
- Flask的session使用
- ansible的plugins
- 使用TensorFlow训练模型的基本流程【转】
- python 操作数据库
- Difference between plt.draw() and plt.show() in matplotlib
- Mac下用zsh
- go语言功能代码