Skip to content

chore(deps): lock file maintenance #2917

chore(deps): lock file maintenance

chore(deps): lock file maintenance #2917

name: Check & Release
on:
push:
branches: [ master, renovate/** ]
pull_request:
branches: [ master ]
jobs:
test:
name: Test
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [ 16, 18, 20, 22 ]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Cache node_modules
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Update NPM
run: npm install --no-audit -g npm@9
if: matrix.node-version < 18
- name: Install Dependencies
run: npm ci --no-audit
- name: Run Tests
run: npm test
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache node_modules
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install Dependencies
run: npm ci --no-audit
- run: npm run build
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache node_modules
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install Dependencies
run: npm ci --no-audit
- run: npm run lint
publish:
name: Publish to NPM
if: github.ref == 'refs/heads/master'
needs: [ test, build, lint ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
fetch-depth: 0 # we need to pull everything to allow lerna to detect what packages changed
ref: master
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache node_modules
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Check for changes
id: changed_packages
run: |
echo "::set-output name=changed_packages::$(npx lerna changed -p | wc -l | xargs)"
- name: Release
if: steps.changed_packages.outputs.changed_packages != '0'
run: |
git config --global user.name 'Apify Release Bot'
git config --global user.email 'noreply@apify.com'
echo "access=public" >> .npmrc
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
npm ci --no-audit
npm run build
git checkout -- .
npx lerna publish --contents dist --yes --no-verify-access
npm i --no-audit # reinstall to have updated lock file
npx lerna ls --json | npx ts-node -T scripts/sync-root-changelog.ts
git commit -am 'chore: update root lock file and changelog [skip ci]'
git push
env:
NODE_AUTH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_NPM_TOKEN }}
GIT_USER: "noreply@apify.com:${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}"
GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_NPM_TOKEN }}