網站首頁 編程語言 正文
由于 Gitee Pages 的訪問速度很快,很多朋友會選擇 Gitee Pages 部署項目(如:個人博客、開源項目國內鏡像站點)。但是它不像 GitHub Pages 那樣,一提交代碼就能自動更新 Pages,因為 Gitee 的自動部署屬于 Gitee Pages Pro 的服務。
有大佬開發了自動更新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
相關推薦
- 2022-07-21 shardingjdbc+mybatisP+Seata 報錯 throw new ShouldNev
- 2022-07-07 python?NetworkX庫生成并繪制帶權無向圖_python
- 2022-06-15 詳解Python進行數據相關性分析的三種方式_python
- 2022-05-27 Flutter狀態管理Bloc之登錄示例_Android
- 2022-06-13 詳解Python如何利用Pandas與NumPy進行數據清洗_python
- 2022-09-12 Python詳解復雜CSV文件處理方法_python
- 2022-09-25 Django 使用定時任務
- 2022-05-07 MongoDB連接和創建數據庫的方法講解_MongoDB
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支