👷 migrate travis ci to github actions (#1415)

This commit is contained in:
Kuitos 2021-04-24 22:56:23 +08:00 committed by GitHub
parent d44d71ae80
commit 6a2ec1af7e
6 changed files with 124 additions and 43 deletions

39
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,39 @@
name: CI
on:
push:
branches: [ $default-branch ]
pull_request:
branches: [ $default-branch ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- run: yarn ci
- run: yarn docs:build

View File

@ -12,7 +12,7 @@ jobs:
env:
NOW_DEPLOY: true
run: |
yarn install
yarn
yarn docs:build
- uses: amondnet/vercel-action@v19
id: vercel-deployment-production

28
.github/workflows/publish-1.x.yml vendored Normal file
View File

@ -0,0 +1,28 @@
name: Publish 1.x VERSION
on:
push:
branches:
- 1.x
tags:
- v1.*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14.x'
check-latest: true
registry-url: 'https://registry.npmjs.org'
- run: yarn
- run: yarn ci
- run: yarn publish --tag qiankun1
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

28
.github/workflows/publish-latest.yml vendored Normal file
View File

@ -0,0 +1,28 @@
name: Publish LATEST VERSION
on:
push:
branches:
- master
tags:
- v2.*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14.x'
check-latest: true
registry-url: 'https://registry.npmjs.org'
- run: yarn
- run: yarn ci
- run: yarn publish --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

28
.github/workflows/publish-next.yml vendored Normal file
View File

@ -0,0 +1,28 @@
name: Publish NEXT VERSION
on:
push:
branches:
- next
tags:
- v3.*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
check-latest: true
registry-url: 'https://registry.npmjs.org'
- run: yarn
- run: yarn ci
- run: yarn publish --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

View File

@ -1,42 +0,0 @@
language: node_js
node_js:
- lts/*
install:
- yarn install
cache:
yarn: true
directories:
- node_modules
script:
- yarn ci
- yarn docs:build
#after_success:
# - npm run codecov
before_deploy: |
function npm_dist_tag() {
if [[ "$TRAVIS_TAG" = *"-"* ]]; then
echo "next"
else
echo "latest"
fi
}
deploy:
- edge: true
provider: npm
email: kuitos.lau@gmail.com
api_key: $NPM_AUTH_TOKEN
skip_cleanup: true
on:
tags: true
tag: $(npm_dist_tag)
- provider: pages
skip_cleanup: true
local_dir: dist
github_token: $GITHUB_TOKEN
keep_history: true
on:
branch: master