Skip to content

chore: publish [skip build] #4396

chore: publish [skip build]

chore: publish [skip build] #4396

Workflow file for this run

name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main and next branches
on:
push:
branches:
- main
- next
- v1
paths-ignore:
- '**/docs/**'
- '**.md'
pull_request:
types: [opened, synchronize, reopened, edited, ready_for_review]
paths-ignore:
- '**/docs/**'
- '**.md'
# Setup concurrency to the ref (branch / tag) that triggered the workflow
concurrency: ci-${{ github.ref }}
# 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 "CI"
CI:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Do not run if the pull request is a draft
if: ${{ !github.event.pull_request.draft && !contains(github.event.commits[0].message, '[skip build]') }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# Use fetch-depth: 0 so that all tags and branches are fetched
# Use persist-credentials: false so that the make release step uses another personal access
# token which has admin access and can push the version commit without the restriction
# of creating a pull-request.
- uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@v2
with:
node-version: '14'
registry-url: 'https://registry.npmjs.org'
scope: '@farfetch'
cache: 'yarn'
always-auth: true
# This is needed for lerna to commit and push the
# new version when making a release
- name: Checkout the source branch in a pull request for lerna
env:
HEAD_REF: ${{ github.head_ref }}
if: ${{ github.event_name == 'pull_request' && startsWith(github.head_ref, 'rc/') }}
run: git checkout "$HEAD_REF"
# This is needed for lerna to commit and push the
# new version when making a release
- name: Checkout the branch for pushes to a branch for lerna
env:
REF_NAME: ${{ github.ref_name }}
if: ${{ github.event_name == 'push' }}
run: git checkout "$REF_NAME"
# Retrieves the commit message to be used in the
# make release step
- name: Get commit message
id: get-commit-message
run: |
COMMIT_MSG=$(git log -1 --pretty=format:"%s")
echo "Commit message is: ${COMMIT_MSG})"
echo ::set-output name=message::${COMMIT_MSG}
- name: Install dependencies
run: yarn install --ignore-engines --frozen-lockfile
- name: Lint
run: yarn lint
- name: Test
run: yarn test --ci
- name: Type checking
run: yarn ci:types
# Only make a release if it is a run of the 'main' or 'next' branches
# or a pull request that contains a 'chore: make release' message
- name: Make release
if: |
github.ref_name == 'main' ||
github.ref_name == 'next'
env:
MAKE_RELEASE_COMMIT_MESSAGE: 'chore: make release'
PUBLISH_COMMIT_MESSAGE: 'chore: publish [skip build]'
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
GIT_AUTHOR_NAME: ${{ secrets.RELEASE_BOT_GIT_NAME }}
GIT_AUTHOR_EMAIL: ${{ secrets.RELEASE_BOT_GIT_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.RELEASE_BOT_GIT_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.RELEASE_BOT_GIT_EMAIL }}
run: yarn ci:release