Skip to content

[ci] Add release automation scripts #72

[ci] Add release automation scripts

[ci] Add release automation scripts #72

Workflow file for this run

# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
name: CI
on: [push, pull_request]
jobs:
build:
name: Tests (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run tests
run: yarn run test
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint
run: yarn run lint
- name: Prettier
run: yarn run prettier-check
release:
name: Publish to NPM
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.repository == 'relayjs/eslint-plugin-relay'
needs: [build, lint]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
cache: 'yarn'
- name: Build latest (main) version
if: github.ref == 'refs/heads/main'
run: yarn version --no-git-tag-version --new-version 0.0.0-main-${GITHUB_SHA}
- name: Build release version
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
run: yarn version --no-git-tag-version --new-version ${GITHUB_REF_NAME:1}
- name: Publish to npm
if: github.ref == 'refs/heads/main' || github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
run: |
for pkg in dist/*; do
npm publish "$pkg" ${TAG}
done
env:
TAG: ${{ github.ref == 'refs/heads/main' && '--tag=main' || ((contains(github.ref_name, '-rc.') && '--tag=dev') || '' )}}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}