feat(ci): switch from travis to github actions

This commit is contained in:
ppoffice 2020-08-14 21:51:14 -04:00
parent 0f73884d17
commit ad8806de5d
No known key found for this signature in database
GPG Key ID: B33335481CC0D498
7 changed files with 101 additions and 56 deletions

20
.github/workflows/github-release.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: GitHub Release
on:
push:
tags:
- "*"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false

12
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,12 @@
name: Code Linting
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- run: npm install
- run: npm run lint

18
.github/workflows/npm-publish.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Node.js Package
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

33
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: Test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10, latest]
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
repository: hexojs/hexo-starter
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v1
with:
path: node_modules
key: npm-cache
restore-keys: npm-cache
- run: npm install
- uses: actions/checkout@v2
with:
path: themes/icarus
- uses: actions/checkout@v2
with:
repository: SukkaLab/hexo-many-posts
path: source/_posts/hexo-many-posts
- run: npx hexo config theme next
- run: time npx hexo g

5
.npmignore Normal file
View File

@ -0,0 +1,5 @@
.github/
.eslintignore
.eslintrc.json
.travis.yml
yarn.lock

View File

@ -1,52 +0,0 @@
language: node_js
os: linux
cache: false
node_js:
- "10"
- "12"
- "node"
script:
- echo "Running tests against $(node -v) ..."
- export DEPS=$(node -e "const deps=require('./package.json').peerDependencies;console.log(Object.keys(deps).map(key=>key+'@'+deps[key]).join(' '));")
- npm install $DEPS
- npm run lint
jobs:
include:
- stage: github pages
node_js: "10"
git:
clone: false
script:
- echo "Publish site to github pages ..."
- git clone --recurse-submodules https://github.com/ppoffice/hexo-theme-icarus.git -b site $TRAVIS_BUILD_DIR
- cd $TRAVIS_BUILD_DIR/themes/icarus
- git fetch origin $TRAVIS_COMMIT && git merge $TRAVIS_COMMIT
- export DEPS=$(node -e "const deps=require('./package.json').peerDependencies;console.log(Object.keys(deps).map(key=>key+'@'+deps[key]).join(' '));")
- cd $TRAVIS_BUILD_DIR
- npm install -g hexo-cli
- npm install
- npm install $DEPS
- hexo g
deploy:
provider: pages
token: $GITHUB_TOKEN
keep_history: false
local_dir: public
skip_cleanup: true
on:
tags: true
- stage: github release
node_js: "10"
script: echo "Deploying to github release ..."
skip_cleanup: false
deploy:
provider: releases
token: $GITHUB_TOKEN
on:
tags: true

View File

@ -1,13 +1,22 @@
{
"name": "hexo-theme-icarus",
"version": "4.0.0-rc.1",
"author": "ppoffice <ppoffice@users.noreply.github.com>",
"license": "MIT",
"description": "A simple, delicate, and modern theme for Hexo",
"keywords": [
"hexo",
"theme",
"icarus"
],
"homepage": "https://github.com/ppoffice/hexo-theme-icarus",
"repository": "https://github.com/ppoffice/hexo-theme-icarus.git",
"bugs": {
"url": "https://github.com/ppoffice/hexo-theme-icarus/issues"
},
"engines": {
"node": ">=10.13.0"
},
"description": "A simple, delicate, and modern theme for Hexo",
"repository": "https://github.com/ppoffice/hexo-theme-icarus.git",
"author": "ppoffice <ppoffice@users.noreply.github.com>",
"license": "MIT",
"scripts": {
"lint": "eslint --ext .js --ext .jsx --ext .json ."
},