Skip to content

feat: cache installed dependencies (#415) #155

feat: cache installed dependencies (#415)

feat: cache installed dependencies (#415) #155

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'packages/**'
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Cache NPM packages
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
shopify-checkout:
- 'packages/shopify-checkout/**'
shopify-cart:
- 'packages/shopify-cart/**'
storefront-sdk-changelog:
- 'packages/storefront-sdk/CHANGELOG.md'
- name: Install Dependencies
run: npm ci
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/[email protected]
with:
commit: 'build: version packages'
title: 'build: version packages'
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NACELLE_NPMJS_TOKEN }}
# - name: Update and commit lockfiles
# if: steps.changesets.outputs.published == 'true'
# run: |
# lerna run --parallel lockfile:update
# git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
# git config --local user.name "github-actions[bot]"
# git commit -a -m "chore(publish): [skip ci] Update lockfiles"
# - name: Commit lockfile changes
# if: steps.changesets.outputs.published == 'true'
# uses: ad-m/[email protected]
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: ${{ github.ref }}
- name: Shopify Checkout - npm run test:coverage
if: steps.changes.outputs.shopify-checkout == 'true'
run: npm run test:coverage
working-directory: packages/shopify-checkout
- name: Analyze with SonarCloud
if: steps.changes.outputs.shopify-checkout == 'true'
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: packages/shopify-checkout
args: >
-Dsonar.organization=getnacelle
-Dsonar.projectKey=getnacelle_nacelle-js_package_shopify_checkout
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
-Dsonar.sources=src
-Dsonar.exclusions=src/**/*.test.ts
-Dsonar.tests=src
-Dsonar.test.inclusions=src/**/*.test.ts
- name: Shopify Cart - npm run test:coverage
if: steps.changes.outputs.shopify-cart == 'true'
run: npm run test:coverage
working-directory: packages/shopify-cart
- name: Analyze with SonarCloud
if: steps.changes.outputs.shopify-cart == 'true'
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: packages/shopify-cart
args: >
-Dsonar.organization=getnacelle
-Dsonar.projectKey=getnacelle_nacelle-js_package_shopify_cart
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
-Dsonar.sources=src
-Dsonar.exclusions=src/**/*.test.ts
-Dsonar.tests=src
-Dsonar.test.inclusions=src/**/*.test.ts
- name: Add Front Matter to SDK Changelogs for Readme
if: steps.changes.outputs.storefront-sdk-changelog == 'true'
run: npm run changelog:frontmatter
working-directory: packages/storefront-sdk
- name: Sync SDK Changelogs to Readme
if: steps.changes.outputs.storefront-sdk-changelog == 'true'
uses: readmeio/rdme@v8
with:
rdme: docs packages/storefront-sdk/changelog-readme.md --key=${{ secrets.README_API_KEY }} --version=2.0