build(deps-dev): bump octokit from 3.1.0 to 3.1.2 #311
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test and Conditionally Publish | |
on: | |
push: | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
- '.markdownlint.json' | |
- '.anylint' | |
- '.editorconfig' | |
- '.env.example' | |
- '.gitattributes' | |
- '.gitignore' | |
- 'commitlint.config.js' | |
- 'LICENSE' | |
pull_request: | |
branches: | |
- master | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
- '.markdownlint.json' | |
- '.anylint' | |
- '.editorconfig' | |
- '.env.example' | |
- '.gitattributes' | |
- '.gitignore' | |
- 'commitlint.config.js' | |
- 'LICENSE' | |
jobs: | |
# [original source of job "check-if-to-skip"](https://github.com/srz-zumix/ci-skip/blob/master/.github/workflows/main.yml#L15) | |
check-if-to-skip: | |
runs-on: ubuntu-latest | |
# skip commits with [ci skip] or [skip ci], except on an action triggered by push of a version tag | |
# TODO: remove or update git tag description | |
if: "!( contains(github.event.head_commit.message, '[ci skip]') || contains(github.event.head_commit.message, '[skip ci]') )" | |
steps: | |
- name: Check [ci skip] or [skip ci] | |
run: exit 0 | |
test: | |
needs: check-if-to-skip | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Read .nvmrc | |
id: nvmrc | |
run: echo "::set-output name=nvmrc::$(cat .nvmrc)" | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ steps.nvmrc.outputs.nvmrc }} | |
- name: Get yarn cache | |
id: yarn-cache-dir | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v1 | |
with: | |
path: ${{ steps.yarn-cache-dir.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install Dependencies | |
run: yarn install --silent --frozen-lockfile --ignore-scripts --ignore-engines | |
env: | |
CI: true | |
- name: Test And Measure Coverage | |
run: yarn test:coverage --ci | |
- name: Lint | |
run: yarn lint:code . | |
e2etest: | |
needs: test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
node-version: [14, 16, 17, 18] | |
os: [ubuntu-latest, macOS-latest, windows-latest, windows-2019] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install Dependencies | |
# only installs packages needed to publish to save time | |
run: yarn add --ignore-scripts --ignore-engines -D typescript shx | |
env: | |
CI: true | |
- name: Use Node.js 16 # for unauthenticated publish, npm version should be high enough | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Run Local Npm Registry (Verdaccio) On Linux Or macOS | |
# verdaccio is private npm registry. [link](https://github.com/verdaccio/verdaccio/) | |
if: startsWith(matrix.os, 'windows') == false # use an operrator "==" as "!startsWith(matrix.os, 'windows')" causes an error | |
run: | | |
# trailing `&` detaches process from foreground | |
yarn verdaccio & | |
- name: Run Local Npm Registry (Verdaccio) On Windows | |
if: startsWith(matrix.os, 'windows') | |
run: | | |
npm install --global forever | |
forever start node_modules\verdaccio\bin\verdaccio --config ./verdaccio/conf/default.yaml | |
- name: Publish To Local NPM Registry | |
run: | | |
# From npm v7, `npm adduser` is required before `npm publish`. | |
# (adduser REF: https://docs.npmjs.com/cli/v7/commands/npm-adduser) | |
# However, `npm adduser` is interactive | |
# and can be substituted by setting `_authToken`. | |
# By local verdaccio setting(verdaccio/conf/default.yaml), | |
# the _authToken can be any random string, | |
# and anyone can publish hasura-cli. | |
npm config set //localhost:4873/:_authToken helloworld | |
npm publish --registry http://localhost:4873 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Test Installation | |
run: | | |
npm install --global hasura-cli --registry http://localhost:4873 | |
hasura version --skip-update-check | |
- name: Test Uninstallation | |
if: startsWith(matrix.os, 'windows') == false | |
run: npm uninstall --global hasura-cli | |
publish: | |
needs: e2etest | |
if: startsWith(github.ref, 'refs/tags/v2.') && ( github.event.base_ref == 'refs/heads/master' ) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Build And Publish To Npm | |
# only runs if name of git tag starts with 'v1.' and on branch master | |
run: | | |
# only installs packages needed to publish to save time | |
yarn add --ignore-scripts --ignore-engines -D typescript shx | |
yarn build # to prevent a mistake thougth there is already prepublishOnly lifecycle hook. | |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} | |
npm publish | |
env: | |
CI: true | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Notify Slack | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
uses: pullreminders/slack-action@master | |
with: | |
args: '{\"channel\":\"C5KTCLYG7\",\"text\":\"hasura-cli is published to NPM.\"}' |