Skip to content

chore: fix tough-cookie version #3741

chore: fix tough-cookie version

chore: fix tough-cookie version #3741

name: Publish packages to npmjs
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
check:
runs-on: ubuntu-latest
outputs:
inputsChecked: ${{ steps.github_token_gate.outputs.inputsChecked }}
steps:
- uses: svrooij/secret-gate-action@v1
id: github_token_gate
with:
inputsToCheck: 'token'
env:
token: ${{ secrets.BOT_GITHUB_TOKEN }}
build:
# skip if user has not access to the token
if: needs.check.outputs.inputsChecked == 'true'
runs-on: ubuntu-latest
needs: check
steps:
#######################
# Checkout #
######################
# For non-pull requests, fetch all tags
- uses: actions/checkout@v2
if: github.event_name != 'pull_request'
with:
fetch-depth: 0
token: ${{ secrets.BOT_GITHUB_TOKEN }}
# For pull requests, also checkout out the REAL commit (as opposed to a merge commit with main)
- uses: actions/checkout@v2
if: github.event_name == 'pull_request'
# For PRs check the actual commit
# https://github.com/actions/checkout/issues/124#issuecomment-586664611
# https://github.com/actions/checkout/issues/455#issuecomment-792228083
with:
fetch-depth: 0
token: ${{ secrets.BOT_GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
# pull all tags since they are required when generating locally
# https://github.com/lerna/lerna/issues/2542
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
if: github.event_name == 'pull_request'
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v2
with:
node-version: '16.18'
registry-url: 'https://registry.npmjs.org'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Prepare
id: prep
run: |
TAG=$(echo $GITHUB_SHA | head -c7)
echo ::set-output name=tag::${TAG}
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn
- name: Install Webapp dependencies
run: yarn install --frozen-lockfile
# This step will bump the package.json version and NOT push to the repository
# this is needed since building grafana requires updating the plugin.json file
# with the package.json version
- name: Bump version, generate changelog etc
if: github.event_name == 'pull_request'
run: |
# Copied from https://github.com/pyroscope-io/pyroscope/blob/main/.github/workflows/update-contributors.yml#L23-L28
git config --global user.email "[email protected]"
git config --global user.name "Pyroscope Bot <[email protected]>"
yarn run lerna version --conventional-commits --conventional-prerelease --yes --no-push --preid=${{ github.event.pull_request.number }}-${{ steps.prep.outputs.tag }}
# This step will bump the package.json version, generate a CHANGELOG.md
# And commit to the repository
- name: Bump version, generate changelog etc
if: github.event_name != 'pull_request'
run: |
# Copied from https://github.com/pyroscope-io/pyroscope/blob/main/.github/workflows/update-contributors.yml#L23-L28
git config --global user.email "[email protected]"
git config --global user.name "Pyroscope Bot <[email protected]>"
yarn run lerna version --conventional-commits --yes
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
# build all packages
- name: Build
run: yarn run lerna run build
#####################
# Publish #
#####################
- name: Publish Main
if: github.event_name != 'pull_request'
run: |
yarn run lerna publish from-package \
--skip-git \
--conventional-commits \
--yes \
--no-verify-access
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Pull Request
# Only publish if it comes from the main repo
if: (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.full_name == github.repository)
run: |
yarn run lerna publish from-git \
--skip-git \
--conventional-commits \
--yes \
--no-verify-access \
--force-publish='*' \
--canary
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}