From 36a0d1aa73fa5468eb3765a8ae889a935209fbff Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Sat, 21 Aug 2021 12:39:56 +0200 Subject: [PATCH] ci: add automate releases --- .github/workflows/main.yml | 40 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 29 --------------------------- package.json | 3 --- 3 files changed, 40 insertions(+), 32 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 0000000..bd3389d --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,40 @@ +name: test + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: lts/* + - name: Install + run: npm install --no-package-lock + - name: Test + run: npm test + - name: Report + run: mkdir -p coverage && npx nyc report --reporter=text-lcov > coverage/lcov.info + - name: Coverage + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Release + if: ${{ github.ref == 'refs/heads/master' && !startsWith(github.event.head_commit.message, 'chore(release):') && !startsWith(github.event.head_commit.message, 'docs:') }} + shell: 'script -q -e -c "bash {0}"' + env: + CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + git config --global user.email ${{ secrets.GIT_EMAIL }} + git config --global user.name ${{ secrets.GIT_USERNAME }} + npm run release diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f47a8cb..0000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: node_js - -node_js: - - node - # - lts/* - -after_success: npm run coverage - -stages: - - Test - if: branch = master AND commit_message !~ /(docs|release|no-release)/ - - name: Release - if: branch = master AND commit_message !~ /(docs|release|no-release)/ - -jobs: - include: - - stage: Release - install: npm install --no-package-lock - before_deploy: - - git config user.email ${GITHUB_EMAIL:-"travis@travis-ci.org"} - - git config user.name ${GITHUB_USER:-"Travis CI"} - - git remote set-url origin https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git - - git checkout master - deploy: - skip_cleanup: true - provider: script - script: npm run release - on: - branch: master \ No newline at end of file diff --git a/package.json b/package.json index b9799ed..c12aed5 100644 --- a/package.json +++ b/package.json @@ -38,10 +38,8 @@ "ava": "latest", "ci-publish": "latest", "conventional-github-releaser": "latest", - "coveralls": "latest", "finepack": "latest", "git-authors-cli": "latest", - "git-dirty": "latest", "iltorb": "latest", "lint-staged": "latest", "npm-check-updates": "latest", @@ -61,7 +59,6 @@ "scripts": { "clean": "rm -rf node_modules", "contributors": "(git-authors-cli && finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true", - "coverage": "nyc report --reporter=text-lcov | coveralls", "lint": "standard-markdown README.md && standard", "postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)", "prerelease": "npm run update:check && npm run contributors",