Skip to content

4.0.0-alpha.6

4.0.0-alpha.6 #10

Workflow file for this run

name: v4.x releases
on:
push:
tags:
- 'v4.[0-9]+.[0-9]+'
- 'v4.[0-9]+.[0-9]+-alpha.[0-9]+'
- 'v4.[0-9]+.[0-9]+-beta.[0-9]+'
# The "test" prerelease version exist solely to validate changes on the
# release workflow. This is intended to be published
- 'v4.[0-9]+.[0-9]+-test.[0-9]+'
jobs:
install:
name: Install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache node_modules
id: cacheModules
uses: actions/cache@v3
with:
path: ~/.npm # cache where "npm install" uses before going out to the network
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
- name: Install dependencies
if: steps.cacheModules.outputs.cache-hit != 'true'
run: npm install
debug:
name: Debug
runs-on: ubuntu-latest
steps:
- uses: hmarr/debug-action@v2
checks:
name: Check
needs: [install]
uses: ./.github/workflows/checks.yml
# The security job can't run on pull requests opened from forks because
# Github doesn't pass down the SNYK_TOKEN environment variable.
security:
name: Check Security
needs: [install]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.npm # cache where "npm install" uses before going out to the network
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
- run: npm install --prefer-offline
- run: make secure
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
major:
runs-on: ubuntu-latest
outputs:
latest: ${{ steps.npm-major.outputs.version }}
steps:
- id: npm-major
run: echo version=$(npm view cross-fetch@latest version | cut -d. -f1) >> "$GITHUB_OUTPUT"
publish:
name: Publish to NPM registry
runs-on: ubuntu-latest
needs: [checks, security, major]
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: '14'
registry-url: 'https://registry.npmjs.org'
- uses: actions/cache@v3
with:
path: ~/.npm # this is cache where npm installs from before going out to the network
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
- run: npm install --prefer-offline
- run: echo "$LATEST"
env:
LATEST: ${{needs.major.outputs.latest}}
- if: ${{ !contains(github.ref_name, '-test.') }}
run: npm publish --tag latest-v4.x
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# If "test" prerelease is present, pretend to publish package.
- if: ${{ contains(github.ref_name, '-test.') }}
run: npm publish --tag latest-v4.x --dry-run
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}