本文主要对github的action做一次备忘,方便以后查阅
进入github仓库 actions 页面
![image-20220511190636223](https://hexo-ufoozhenghao.oss-cn-beijing.aliyuncs.com/BlogHexo/image-20220511190636223.png)
选择 set up a workflow yourself
![image-20220511190721414](https://hexo-ufoozhenghao.oss-cn-beijing.aliyuncs.com/BlogHexo/image-20220511190721414.png)
名称随意,我这里设置为ci.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| name: Build app and deploy to tencent on: push: branches: - master jobs: build:
runs-on: ubuntu-latest
steps: - uses: actions/checkout@v1 - name: Install Node.js uses: actions/setup-node@v1 with: node-version: '16.13.1' - name: Install yarn run: npm install -g yarn - name: Install yarn dependencies run: yarn install - name: Run build task run: yarn run build - name: Deploy to Server uses: easingthemes/ssh-deploy@v2.1.5 env: SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }} ARGS: '-rltgoDzvO --delete' SOURCE: public REMOTE_HOST: '124.220.xx.xx' REMOTE_USER: root TARGET: /www/wwwroot/hexo/
|
对ci.yml
中的secrets进行设置。Name为 SERVER_SSH_KEY
,Value为ssh私钥,同时注意将公钥上传至服务器。这里不再展开。
![image-20220511191258602](https://hexo-ufoozhenghao.oss-cn-beijing.aliyuncs.com/BlogHexo/image-20220511191258602.png)
至此,配置完成。workflow会自动工作,失败时会得到邮件通知。