From 8bd7ca2a6534119dbc3aa5c45f51c5e64f697a3d Mon Sep 17 00:00:00 2001 From: Simon Mumenthaler Date: Fri, 12 Jun 2020 18:57:20 +0200 Subject: [PATCH] chore(build): move from travis to github workflows --- .github/workflows/main.yml | 65 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 22 ------------- 2 files changed, 65 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..c398bc8e2 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,65 @@ +name: Lint, Test, Build and optionally Publish + +on: + # push only for branches (ignore tags) + push: + branches: + - '**' + tags-ignore: + - '**' + # pull request only for branches (ignore tags) + pull_request: + branches: + - '**' + tags-ignore: + - '**' +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2.2.0 + - name: Install Node v12 + uses: actions/setup-node@v2-beta + with: + node-version: 12 + - uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: install + run: npm ci + - name: lint, test, and build + run: | + npm run lint:ci + npm run test:ci + npm run build + env: + CI: true + # report coverage only for non PR + - name: coveralls + if: ${{ startsWith(github.ref, 'refs/pull/') == false }} + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + # publish to latest if on master branch + - name: release master + if: ${{ github.ref == 'master' }} + run: | + npm run docs:build + npx semantic-release + npm run docs:deploy + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + # publish pre-release if non master branch and allowed by .releaserc.yml configuration (only for non-PR branches) + - name: release non-master version + if: ${{ github.ref != 'master' && startsWith(github.ref, 'refs/pull/') == false }} + run: npx semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 00f5dc8ef..000000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: node_js -node_js: - - lts/* - -cache: npm - -install: - - npm ci - -notifications: - email: false - -script: - - npm run lint:ci - - npm run test:ci - - npm run build - - npm run docs:build - -after_success: - - npm run report-coverage - - npm run docs:deploy - - npx semantic-release