Skip to content

update: Docker

update: Docker #156

Workflow file for this run

name: CI
#on: [push]
# 在master分支发生push事件时触发。
on:
push:
branches:
- master
jobs: # 工作流
build: # 自定义名称
runs-on: ubuntu-latest #运行在虚拟机环境ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps: # 步骤
- name: Checkout # 步骤1
# 使用的动作。格式:userName/repoName。作用:检出仓库,获取源码。 官方actions库:https://github.com/actions
uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }} # 步骤2
uses: actions/setup-node@v1 # 作用:安装nodejs
with:
node-version: ${{ matrix.node-version }} # 版本
#-------------------------------------------------------------------
- name: Configure Private Key #★★★★★★ 步骤3:设置ssh ★★★★★★
env:
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} # gitee的ssh
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo "StrictHostKeyChecking no" >> ~/.ssh/config
- name: Push Gitee Mirror #★★★★★★ 步骤4:推送到gitee★★★★★★
env:
SOURCE_REPO: 'https://github.com/oddfar/notes.git' #github 仓库地址
DESTINATION_REPO: '[email protected]:oddfar/notes.git' #gitee 仓库地址
run: |
git clone --mirror "$SOURCE_REPO" && cd `basename "$SOURCE_REPO"`
git remote set-url --push origin "$DESTINATION_REPO"
git fetch -p origin
git for-each-ref --format 'delete %(refname)' refs/pull | git update-ref --stdin
git push --mirror
#-------------------------------------------------------------------
- name: run deploy.sh # 步骤5:执行脚本deploy.sh
env: # 设置环境变量,未设置则不运行
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} # toKen私密变量
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} # gitee的ssh
run: npm install && npm run deploy
## ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
## 注意:不需要同步到gitee镜像,则把步骤3和4删掉