7.8.1 #46
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish packages | |
on: | |
release: | |
types: [published] | |
jobs: | |
setup: | |
name: Yarn install 🛠️ | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
registry-url: 'https://registry.npmjs.org' | |
# node_module cache helps to avoid 1 minute copying from yarn cache on every job run | |
- name: node_modules cache | |
id: node-modules-cache | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-modules-yarn-${{ hashFiles('yarn.lock') }} | |
restore-keys: ${{ runner.os }}-node-modules-yarn- | |
- name: Yarn install | |
if: steps.node-modules-cache.outputs.cache-hit != 'true' | |
run: yarn install --prefer-offline --frozen-lockfile | |
build: | |
name: Build 📦 | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
needs: setup | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.ref }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Restore node_modules from cache | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-modules-yarn-${{ hashFiles('yarn.lock') }} | |
- name: Install Doppler CLI | |
uses: dopplerhq/cli-action@v2 | |
- name: Build 📦 | |
run: > | |
doppler run --mount .env -- yarn nx run-many --target=build | |
env: | |
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }} | |
lint: | |
name: Lint 🎨 | |
runs-on: ubuntu-latest | |
needs: setup | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
# fetch-depth gives the complete git history which is needed for nx. | |
fetch-depth: 0 | |
ref: ${{ github.ref }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Restore node_modules from cache | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-modules-yarn-${{ hashFiles('yarn.lock') }} | |
- name: Derive appropriate SHAs for base and head for `nx affected` commands | |
uses: nrwl/nx-set-shas@v3 | |
- name: Check Format | |
run: yarn nx format:check --verbose | |
- name: Lint 🎨 | |
run: yarn nx run-many --target=lint | |
tests: | |
name: Tests 🧪 | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
needs: setup | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.ref }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Restore node_modules from cache | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-modules-yarn-${{ hashFiles('yarn.lock') }} | |
- name: Install Doppler CLI | |
uses: dopplerhq/cli-action@v2 | |
- name: Test 🧪 | |
run: > | |
doppler run --mount .env -- yarn nx run-many --target=test | |
env: | |
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }} | |
license-check: | |
name: License check 📄 | |
runs-on: ubuntu-latest | |
needs: setup | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.ref }} | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
lock: | |
- 'yarn.lock' | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Restore node_modules from cache | |
uses: actions/cache@v3 | |
if: steps.filter.outputs.lock == 'true' | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-modules-yarn-${{ hashFiles('yarn.lock') }} | |
- name: Run License Checker | |
if: steps.filter.outputs.lock == 'true' | |
run: > | |
echo "In case of error, please check ./docs/Licenses.md" | |
yarn license-checker \ | |
--summary \ | |
--production \ | |
--relativeLicensePath \ | |
--onlyAllow 'MIT;Apache-2.0;ISC;BSD-3-Clause;BSD-2-Clause;MIT*;Apache 2.0;Unlicense;:CC0-1.0;CC-BY-4.0;WTFPL;0BSD;UNLICENSED;Python-2.0;MPL-2.0;CC-BY-3.0;CC0-1.0' | |
publish: | |
name: Publish to NPM 🚀 | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
permissions: | |
id-token: write # This is required for NPM provenance on publish | |
contents: read # To checkout the repo | |
actions: read | |
needs: | |
- build | |
- lint | |
- tests | |
- license-check | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.ref }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Restore node_modules from cache | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-modules-yarn-${{ hashFiles('yarn.lock') }} | |
- name: Install Doppler CLI | |
uses: dopplerhq/cli-action@v2 | |
- name: Echo github event release metadatas | |
run: echo "$JOB_CONTEXT" | |
env: | |
JOB_CONTEXT: ${{ toJson(github.event.release) }} | |
- run: doppler run --mount .env -- ./tools/bump_and_publish_sdks.sh | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TAG: ${{ github.event.release.tag_name }} | |
# we run nx build in the script, so we might need some env vars | |
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }} |