Release #127
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: 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/[email protected] | |
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: Set up SSH for deploy key | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.DOM_MUTATOR_ACCESS_KEY }}" > ~/.ssh/id_ed25519 | |
chmod 600 ~/.ssh/id_ed25519 | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
continue-on-error: true # forked repos don't have access, and this is only for experiment-tag | |
shell: bash | |
- name: Install | |
run: yarn install --frozen-lockfile | |
- name: Build | |
run: npx lerna exec yarn | |
- name: Test | |
run: yarn test | |
- name: Configure Git User | |
run: | | |
git config --global user.name amplitude-sdk-bot | |
git config --global user.email [email protected] | |
- name: Release (Dry Run) | |
if: ${{ github.event.inputs.dryRun == 'true'}} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: yarn lerna version --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 --yes | |
yarn lerna publish from-git --yes --loglevel silly |