From 7a920299e9f5387a1dca562dde50ea071b0a58df Mon Sep 17 00:00:00 2001 From: lshadler Date: Mon, 27 Sep 2021 08:35:38 -0700 Subject: [PATCH] fix: use github actions --- .circleci/config.yml | 46 --------------------------- .github/workflows/ci.yml | 52 +++++++++++++++++++++---------- .github/workflows/npm-publish.yml | 51 ++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 62 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/npm-publish.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index b629baa6..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,46 +0,0 @@ ---- -version: 2 -jobs: - # This plugin requires a custom image to test releases. - # Currently it's using Node v10. - node-12: &test - docker: - - image: circleci/node:erbium - working_directory: ~/cli - steps: - - checkout - - restore_cache: &restore_cache - keys: - - v3-yarn-{{checksum ".circleci/config.yml"}}-{{ checksum "yarn.lock"}} - - v3-yarn-{{checksum ".circleci/config.yml"}} - - run: yarn - - run: yarn lint - - run: yarn build - - run: yarn test - release: - <<: *test - steps: - - add_ssh_keys - - checkout - - restore_cache: *restore_cache - - run: yarn --frozen-lockfile - - run: | - yarn semantic-release -e @oclif/semantic-release - - save_cache: - key: v3-yarn-{{checksum ".circleci/config.yml"}}-{{checksum "yarn.lock"}} - paths: - - ~/cli/node_modules - - /usr/local/share/.cache/yarn - - /usr/local/share/.config/yarn - -workflows: - version: 2 - "@oclif/plugin-update": - jobs: - - node-12 - - release: - context: org-global - filters: - branches: {only: master} - requires: - - node-12 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc1ca463..6ae18575 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,26 +1,46 @@ -name: Node.js CI +name: PR Merge Verification +# Controls when the action will run. on: - push: - branches: [ master ] + # Triggers the workflow on push or pull request events but only for the main branch pull_request: branches: [ master ] + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: + # This workflow contains a single job called "build" build: - runs-on: windows-latest + # The type of runner that the job will run on + runs-on: ubuntu-latest + strategy: matrix: - node-version: [10.x, 12.x] + node-version: [10.x, 12.x, 14.x, 16.x] + steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: yarn install - env: - CI: true - - run: yarn test - env: - CI: true + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: Cache Node.js modules + uses: actions/cache@v2 + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: '**/node_modules' + key: ${{ runner.OS }}-node-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.OS }}-node-${{ matrix.node-version }} + ${{ runner.OS }}-node- + ${{ runner.OS }}- + - name: Install Dependencies + run: yarn install --frozen-lockfile + - name: Lint files + run: yarn lint + - name: Test + run: yarn test + - name: Generate assets + run: yarn build \ No newline at end of file diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 00000000..8e9346cd --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,51 @@ +# This is a basic workflow to help you get started with Actions + +name: Release with Testing + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + release: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [15.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: Cache Node.js modules + uses: actions/cache@v2 + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: '**/node_modules' + key: ${{ runner.OS }}-node-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.OS }}-node-${{ matrix.node-version }} + ${{ runner.OS }}-node- + ${{ runner.OS }}- + - name: Install Dependencies + run: yarn install --frozen-lockfile + - name: Generate assets + run: yarn build + - name: Release + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + git fetch --tags + yarn semantic-release -e @oclif/semantic-release \ No newline at end of file