騰訊云服務器+寶塔+FinalShell+githup
1.在云服務器上創建SSH秘鑰對,下載秘鑰到本地
2.在服務器中綁定秘鑰對(綁定后,服務器不能將不允許密碼登錄)綁定前先關機服務器,綁定后再開啟服務器
3.FinalShell改為公鑰登錄,找到下載到本地的文件登錄
4.在code中新增.githup\workflows文件夾(固定名),文件夾內新建一個文件,名字隨意比如push.yml
name: 打包應用并上傳騰訊云on:push:branches:- masterjobs:build:# runs-on 指定job任務運行所需要的虛擬機環境(必填字段)runs-on: ubuntu-lateststeps:# 獲取源碼- name: 遷出代碼# 使用action庫 actions/checkout獲取源碼uses: actions/checkout@master# 安裝Node10- name: 安裝node.js# 使用action庫 actions/setup-node安裝nodeuses: actions/setup-node@v1with:node-version: 14.0.0# 安裝依賴- name: 安裝依賴run: npm install# 打包- name: 打包run: npm run build# 上傳阿里云- name: 發布到騰訊云uses: easingthemes/ssh-deploy@v2.1.1env:# 私鑰SSH_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}# scp參數ARGS: '-avzr --delete'# 源目錄SOURCE: 'dist'# 服務器ip:換成你的服務器IPREMOTE_HOST: ${{ secrets.REMOTE_HOST }}# 用戶REMOTE_USER: 'root'# 目標地址TARGET: '/www/wwwroot'
5.配置githup的Settings > Secrets > Actions > New repository secret?
(1)Name: REMOTE_HOST,? Value: 服務器的ip地址,比如43.155.73.222
(2)Name:PRIVATE_KEY, Value:秘鑰內容就是下載到本地的秘鑰內容
6.windows上githup訪問失敗或網速慢的解決方案:
1.復制以下內容:
# GitHub520 Host Start
140.82.113.26 ? ? ? ? ? ? ? ? alive.github.com
140.82.112.25 ? ? ? ? ? ? ? ? live.github.com
185.199.108.154 ? ? ? ? ? ? ? github.githubassets.com
140.82.112.22 ? ? ? ? ? ? ? ? central.github.com
185.199.108.133 ? ? ? ? ? ? ? desktop.githubusercontent.com
185.199.108.153 ? ? ? ? ? ? ? assets-cdn.github.com
185.199.108.133 ? ? ? ? ? ? ? camo.githubusercontent.com
185.199.108.133 ? ? ? ? ? ? ? github.map.fastly.net
199.232.69.194 ? ? ? ? ? ? ? ?github.global.ssl.fastly.net
140.82.112.3 ? ? ? ? ? ? ? ? ?gist.github.com
185.199.108.153 ? ? ? ? ? ? ? github.io
140.82.112.4 ? ? ? ? ? ? ? ? ?github.com
192.0.66.2 ? ? ? ? ? ? ? ? ? ?github.blog
140.82.114.5 ? ? ? ? ? ? ? ? ?api.github.com
185.199.108.133 ? ? ? ? ? ? ? raw.githubusercontent.com
185.199.108.133 ? ? ? ? ? ? ? user-images.githubusercontent.com
185.199.108.133 ? ? ? ? ? ? ? favicons.githubusercontent.com
185.199.108.133 ? ? ? ? ? ? ? avatars5.githubusercontent.com
185.199.108.133 ? ? ? ? ? ? ? avatars4.githubusercontent.com
185.199.108.133 ? ? ? ? ? ? ? avatars3.githubusercontent.com
185.199.108.133 ? ? ? ? ? ? ? avatars2.githubusercontent.com
185.199.108.133 ? ? ? ? ? ? ? avatars1.githubusercontent.com
185.199.108.133 ? ? ? ? ? ? ? avatars0.githubusercontent.com
185.199.108.133 ? ? ? ? ? ? ? avatars.githubusercontent.com
140.82.113.9 ? ? ? ? ? ? ? ? ?codeload.github.com
52.217.44.188 ? ? ? ? ? ? ? ? github-cloud.s3.amazonaws.com
52.217.33.196 ? ? ? ? ? ? ? ? github-com.s3.amazonaws.com
52.216.93.147 ? ? ? ? ? ? ? ? github-production-release-asset-2e65be.s3.amazonaws.com
52.216.93.147 ? ? ? ? ? ? ? ? github-production-user-asset-6210df.s3.amazonaws.com
52.217.207.33 ? ? ? ? ? ? ? ? github-production-repository-file-5c1aeb.s3.amazonaws.com
185.199.108.153 ? ? ? ? ? ? ? githubstatus.com
64.71.144.211 ? ? ? ? ? ? ? ? github.community
23.100.27.125 ? ? ? ? ? ? ? ? github.dev
140.82.113.22 ? ? ? ? ? ? ? ? collector.github.com
13.107.42.16 ? ? ? ? ? ? ? ? ?pipelines.actions.githubusercontent.com
185.199.108.133 ? ? ? ? ? ? ? media.githubusercontent.com
185.199.108.133 ? ? ? ? ? ? ? cloud.githubusercontent.com
185.199.108.133 ? ? ? ? ? ? ? objects.githubusercontent.com
# Update time: 2022-06-01T10:55:12+08:00
# Update url: https://raw.hellogithub.com/hosts
# Star me: https://github.com/521xueweihan/GitHub520
# GitHub520 Host End
2.修改 hosts 文件
hosts 文件在每個系統的位置不一,詳情如下:Windows 系統:C:\Windows\System32\drivers\etc\hosts
Linux 系統:/etc/hosts
Mac(蘋果電腦)系統:/etc/hosts
Android(安卓)系統:/system/etc/hosts
iPhone(iOS)系統:/etc/hosts
修改方法,把第一步的內容復制到文本末尾:Windows 使用記事本。
Linux、Mac 使用 Root 權限:sudo vi /etc/hosts。
iPhone、iPad 須越獄、Android 必須要 root。
?3.激活生效
大部分情況下是直接生效,如未生效可嘗試下面的辦法,刷新 DNS:Windows:在 CMD 窗口輸入:ipconfig /flushdns,ipconfig /renew
Linux 命令:sudo nscd restart,如報錯則須安裝:sudo apt install nscd 或 sudo /etc/init.d/nscd restart
Mac 命令:sudo killall -HUP mDNSResponder