網(wǎng)站首頁 編程語言 正文
由于 Gitee Pages 的訪問速度很快,很多朋友會選擇 Gitee Pages 部署項目(如:個人博客、開源項目國內(nèi)鏡像站點)。但是它不像 GitHub Pages 那樣,一提交代碼就能自動更新 Pages,因為 Gitee 的自動部署屬于 Gitee Pages Pro 的服務(wù)。
有大佬開發(fā)了自動更新Gitee pages的action,其中也包含了github 同步到gitee 的代碼,詳見:https://github.com/yanglbme/gitee-pages-action
但有時候我想在同步之前對代碼做些處理,比如替換github.io的鏈接,但是保持此github倉庫不變,就需要自己寫同步代碼了,我寫好的代碼如下:注意:需要在倉庫的settings(不是賬號的settings) => secrets/action ,添加New repository secret ,名字是GITEE_TOKEN, 值就是gitee token
name: Github 同步到 Gitee
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ master ]
#pull_request:
# branches: [ main ]
#schedule:
#- cron: '30 0/3 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
run:
name: 把該倉庫同步到 Gitee(使用白名單只同步這個倉庫)
runs-on: ubuntu-latest
steps:
# - name: Mirror Github to Gitee with white list
# uses: Yikun/hub-mirror-action@master
# with:
# src: github/nmy
# dst: gitee/nmy
# dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
# dst_token: ${{ secrets.GITEE_TOKEN }}
# mappings: "nmy.github.io=>nmy"
# static_list: "nmy.github.io"
# force_update: true
# debug: true
- name: Mirror Github to Gitee with white list
env:
GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }}
run: |
git config --global user.email xxxxxx@qq.com
git config --global user.name nmy
git clone https://github.com/nmy/nmy.github.io.git
ls -al
mv nmy.github.io nmy && cd nmy
pwd
find . -type f | xargs sed -i "s/nmy.github.io/nmy.gitee.io/g"
git add .
git commit -m "update" -a
git push --force --quiet https://nmy:"$GITEE_TOKEN"@gitee.com/nmy/nmy.git master:master
原文鏈接:https://nmydt.blog.csdn.net/article/details/124523405
相關(guān)推薦
- 2022-04-24 redis用list做消息隊列的實現(xiàn)示例_Redis
- 2022-03-03 iview 在 Table 組件中,文字過長用省略號代替,鼠標(biāo)放上去 Tooltip 文字提示
- 2023-01-19 Pycharm?2to3配置,python2轉(zhuǎn)python3方式_python
- 2023-02-05 scipy.interpolate插值方法實例講解_python
- 2022-05-10 IDEA中報錯 “Error running ‘Application‘: Command line
- 2022-09-26 Transformer模型Encoder和Decoder的Pytorch逐行實現(xiàn)
- 2022-11-07 react使用websocket實時通信方式_React
- 2022-04-12 Oracle?Session每日統(tǒng)計功能實現(xiàn)_oracle
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支