* 测试自动发布源 #41
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: JS爬虫发布 | |
on: | |
push: | |
tags: | |
- jsV[0-9]+.* | |
jobs: | |
build: | |
name: TVSpider | |
runs-on: ubuntu-latest # 如果是镜像中启动无法获取git信息 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ "ubuntu-latest" ] #, "macos-latest", "windows-latest" | |
steps: | |
- name: 下载代码 | |
uses: actions/checkout@v3 | |
with: | |
repository: jadehh/TVSpider | |
fetch-depth: 0 # 显示所有提交的日志 | |
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT | |
- name: 下载需要打包更新的代码 | |
uses: actions/checkout@v3 | |
with: | |
repository: jadehh/TVSpider | |
ref: js | |
path: code | |
fetch-depth: 0 | |
token: ${{ secrets.GH_PAT }} | |
- name: 发布版本 | |
run: | | |
cd code/nodejs | |
npm install qs --save | |
npm install | |
npm run build | |
- name: 新建分支 | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "jade" | |
checkname=$(git rev-list --max-parents=0 HEAD) | |
git checkout $checkname -b dist ##分支不存在用这个 | |
# git checkout dist ## 分支已存在用这个 | |
cp -r code/nodejs/dist/* ./ | |
git add index.config.js | |
git add index.config.js.md5 | |
git add index.js | |
git add index.js.md5 | |
commit_msg="* 发布源" | |
git commit -a -m "$commit_msg" | |
- name: 查看分支 | |
run: | | |
ls -l | |
- name: 上传分支 | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GH_PAT }} | |
repository: jadehh/TVSpider | |
directory: . | |
branch: dist | |
force: true | |
tags: true | |
env: | |
GITHUB_ACTOR: jadehh |