Skip to content

release

release #41

# Copyright (c) 2022-present New Relic Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
---
name: "release"
# Controls when the action will run.
# Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
confirmation:
# Friendly description to be shown in the UI instead of 'name'
description: 'Are you sure you want to release?'
type: boolean
# Default value if no value is explicitly provided
default: false
# Input has to be provided for the workflow to run
required: true
# 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 "greet"
release:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [16.x]
os: [ubuntu-latest]
# Steps represent a sequence of tasks that
# will be executed as part of the job
steps:
- name: Checkout the release branch for testing
uses: actions/checkout@v2
with:
ref: main
# token: ${{ secrets.API_CLI_TOKEN }}
# path: newrelic-actions # This might have to exist within ".github"
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1 # https://github.com/actions/setup-node
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
- name: Install Dependencies
run: |
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
- name: Run all test cases
run: npm run test
- name: Publish as NPM package on new relic account(we need npm secret from new relic account)
env:
NODE_AUTH_TOKEN: ${{secrets.MOBILE_AGENT_NPM_TOKEN}}
run: npm publish
- name: Capture logs if previous failure
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: ${{ github.workflow }}-npm-logs
path: |
/home/runner/.npm/_logs/
# Check ENV variables
- name: Check environmental variables
if: ${{ always() }}
run: printenv | sort -f