From ad8806de5df9a6c132f8251ddb95b996f618730f Mon Sep 17 00:00:00 2001 From: ppoffice Date: Fri, 14 Aug 2020 21:51:14 -0400 Subject: [PATCH] feat(ci): switch from travis to github actions --- .github/workflows/github-release.yml | 20 +++++++++++ .github/workflows/lint.yml | 12 +++++++ .github/workflows/npm-publish.yml | 18 ++++++++++ .github/workflows/test.yml | 33 ++++++++++++++++++ .npmignore | 5 +++ .travis.yml | 52 ---------------------------- package.json | 17 ++++++--- 7 files changed, 101 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/github-release.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/npm-publish.yml create mode 100644 .github/workflows/test.yml create mode 100644 .npmignore delete mode 100644 .travis.yml diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml new file mode 100644 index 0000000..54336dc --- /dev/null +++ b/.github/workflows/github-release.yml @@ -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 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..0f76f40 --- /dev/null +++ b/.github/workflows/lint.yml @@ -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 diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..3867f39 --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -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 }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..793254b --- /dev/null +++ b/.github/workflows/test.yml @@ -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 diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..04642d9 --- /dev/null +++ b/.npmignore @@ -0,0 +1,5 @@ +.github/ +.eslintignore +.eslintrc.json +.travis.yml +yarn.lock diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ca2a833..0000000 --- a/.travis.yml +++ /dev/null @@ -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 diff --git a/package.json b/package.json index 68e905d..bc0acf8 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,22 @@ { "name": "hexo-theme-icarus", "version": "4.0.0-rc.1", + "author": "ppoffice ", + "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 ", - "license": "MIT", "scripts": { "lint": "eslint --ext .js --ext .jsx --ext .json ." },