Skip to content

Release

Release #61

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
dryRun:
description: 'Do a dry run to preview instead of a real release'
required: true
default: 'true'
jobs:
authorize:
name: Authorize
runs-on: ubuntu-latest
steps:
- name: ${{ github.actor }} permission check to do a release
uses: octokit/request-action@v2.0.0
with:
route: GET /repos/:repository/collaborators/${{ github.actor }}
repository: ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
name: Release
runs-on: ubuntu-latest
needs: [authorize]
steps:
- name: Checkout
uses: actions/checkout@v2
# Needed for lerna version to determine last tag
- name: Fetch
run: git fetch --prune --unshallow --tags
- name: Cache Node Modules
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install
run: yarn install --frozen-lockfile
- name: Build
run: npx lerna exec yarn
- name: Test
run: yarn test --testPathIgnorePatterns "benchmark.test.ts"
- name: Configure Git User
run: |
git config --global user.name amplitude-sdk-bot
git config --global user.email amplitude-sdk-bot@users.noreply.github.com
- name: Release (Dry Run)
if: ${{ github.event.inputs.dryRun == 'true'}}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn lerna version -m "chore(release): publish %s" \
--conventional-commits \
--no-push \
--no-git-tag-version \
--loglevel silly \
--yes
- name: Setup NPM Token
if: ${{ github.event.inputs.dryRun == 'false'}}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
- name: Release
if: ${{ github.event.inputs.dryRun == 'false'}}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn lerna version -m "chore(release): publish %s" \
--conventional-commits \
--create-release github \
--loglevel silly \
--yes
yarn lerna publish from-git --yes --loglevel silly