From 63d82c844768ecf38bc8dde273964f084c16d7bc Mon Sep 17 00:00:00 2001 From: Ben Freshwater Date: Tue, 23 Jul 2024 13:40:31 +0100 Subject: [PATCH] Backstage/trial cloudsmith (#1752) * backstage: use Cloudsmith to install node modules * chore: change to trial install * chore: change to trial install * backstage: correct typos in scripts * backstage: use Cloudsmith on all CI workflows --- .github/workflows/build-websites.yml | 9 ++++++++- .github/workflows/check-config.yml | 9 ++++++++- .github/workflows/check-privacy.yml | 9 ++++++++- .github/workflows/chromatic.yml | 8 +++++++- .github/workflows/o2-chromatic.yml | 8 +++++++- .github/workflows/o2-composition-chromatic.yml | 8 +++++++- .github/workflows/percy.yml | 18 ++++++++++++++++-- .github/workflows/test.yml | 9 ++++++++- templates/percy-workflow.yml | 18 ++++++++++++++++-- templates/test-workflow.yml | 9 ++++++++- 10 files changed, 93 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-websites.yml b/.github/workflows/build-websites.yml index 67adac886c..4071a2fb76 100644 --- a/.github/workflows/build-websites.yml +++ b/.github/workflows/build-websites.yml @@ -18,7 +18,14 @@ jobs: with: node-version: 18.x cache: 'npm' - - run: npm ci + - name: Configure Cloudsmith + env: + CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} + run: | + npm config set registry=https://npm.packages.ft.com/financial-times-internal-releases/ + npm config set //npm.packages.ft.com/financial-times-internal-releases/:_authToken=${CLOUDSMITH_API_KEY} + - name: Install node modules + run: npm ci - run: bash ./scripts/build-website.bash - run: touch ./origami.ft.com/.nojekyll - name: deploy 🚀 diff --git a/.github/workflows/check-config.yml b/.github/workflows/check-config.yml index 55fdb7aee7..56a721aa66 100644 --- a/.github/workflows/check-config.yml +++ b/.github/workflows/check-config.yml @@ -18,6 +18,13 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - run: npm ci + - name: Configure Cloudsmith + env: + CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} + run: | + npm config set registry=https://npm.packages.ft.com/financial-times-internal-releases/ + npm config set //npm.packages.ft.com/financial-times-internal-releases/:_authToken=${CLOUDSMITH_API_KEY} + - name: Install node modules + run: npm ci - run: npm run regenerate - run: ./scripts/check-for-changes.bash diff --git a/.github/workflows/check-privacy.yml b/.github/workflows/check-privacy.yml index 5fa62e49e9..c3b5733129 100644 --- a/.github/workflows/check-privacy.yml +++ b/.github/workflows/check-privacy.yml @@ -18,5 +18,12 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - run: npm ci + - name: Configure Cloudsmith + env: + CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} + run: | + npm config set registry=https://npm.packages.ft.com/financial-times-internal-releases/ + npm config set //npm.packages.ft.com/financial-times-internal-releases/:_authToken=${CLOUDSMITH_API_KEY} + - name: Install node modules + run: npm ci - run: node ./scripts/check-privacy.js diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index a6ff2393d0..5a3a03584e 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -31,7 +31,13 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 # 👈 Required to retrieve git history - - name: Install dependencies + - name: Configure Cloudsmith + env: + CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} + run: | + npm config set registry=https://npm.packages.ft.com/financial-times-internal-releases/ + npm config set //npm.packages.ft.com/financial-times-internal-releases/:_authToken=${CLOUDSMITH_API_KEY} + - name: Install node modules run: npm ci # 👇 Adds Chromatic as a step in the workflow - name: Publish to Chromatic diff --git a/.github/workflows/o2-chromatic.yml b/.github/workflows/o2-chromatic.yml index d0e612f586..6c87a460b9 100644 --- a/.github/workflows/o2-chromatic.yml +++ b/.github/workflows/o2-chromatic.yml @@ -28,7 +28,13 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 # 👈 Required to retrieve git history - - name: Install dependencies + - name: Configure Cloudsmith + env: + CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} + run: | + npm config set registry=https://npm.packages.ft.com/financial-times-internal-releases/ + npm config set //npm.packages.ft.com/financial-times-internal-releases/:_authToken=${CLOUDSMITH_API_KEY} + - name: Install node modules run: npm ci # 👇 Adds Chromatic as a step in the workflow - name: Publish Origami to Chromatic diff --git a/.github/workflows/o2-composition-chromatic.yml b/.github/workflows/o2-composition-chromatic.yml index 945b5bd953..4090931aee 100644 --- a/.github/workflows/o2-composition-chromatic.yml +++ b/.github/workflows/o2-composition-chromatic.yml @@ -16,7 +16,13 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 # 👈 Required to retrieve git history - - name: Install dependencies + - name: Configure Cloudsmith + env: + CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} + run: | + npm config set registry=https://npm.packages.ft.com/financial-times-internal-releases/ + npm config set //npm.packages.ft.com/financial-times-internal-releases/:_authToken=${CLOUDSMITH_API_KEY} + - name: Install node modules run: npm ci # 👇 Adds Chromatic as a step in the workflow - name: Publish Origami to Chromatic diff --git a/.github/workflows/percy.yml b/.github/workflows/percy.yml index 64ca0e52b4..9c197ef337 100644 --- a/.github/workflows/percy.yml +++ b/.github/workflows/percy.yml @@ -44,7 +44,14 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - run: npm ci + - name: Configure Cloudsmith + env: + CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} + run: | + npm config set registry=https://npm.packages.ft.com/financial-times-internal-releases/ + npm config set //npm.packages.ft.com/financial-times-internal-releases/:_authToken=${CLOUDSMITH_API_KEY} + - name: Install node modules + run: npm ci - name: Find components affected by changes id: percy-changes run: | @@ -90,7 +97,14 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - run: npm ci + - name: Configure Cloudsmith + env: + CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} + run: | + npm config set registry=https://npm.packages.ft.com/financial-times-internal-releases/ + npm config set //npm.packages.ft.com/financial-times-internal-releases/:_authToken=${CLOUDSMITH_API_KEY} + - name: Install node modules + run: npm ci - name: Start Percy check env: PERCY_TOKEN: ${{ secrets[matrix.token_name] }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c4b5da1f35..e58053f67c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -223,7 +223,14 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - run: npm ci + - name: Configure Cloudsmith + env: + CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} + run: | + npm config set registry=https://npm.packages.ft.com/financial-times-internal-releases/ + npm config set //npm.packages.ft.com/financial-times-internal-releases/:_authToken=${CLOUDSMITH_API_KEY} + - name: Install node modules + run: npm ci - run: npm run -w ${{ matrix.component }} lint --if-present - run: npm run -w ${{ matrix.component }} build --if-present - run: npm run -w ${{ matrix.component }} test --if-present diff --git a/templates/percy-workflow.yml b/templates/percy-workflow.yml index 68d22b056e..e1ba1b23fd 100644 --- a/templates/percy-workflow.yml +++ b/templates/percy-workflow.yml @@ -45,7 +45,14 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - run: npm ci + - name: Configure Cloudsmith + env: + CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} + run: | + npm config set registry=https://npm.packages.ft.com/financial-times-internal-releases/ + npm config set //npm.packages.ft.com/financial-times-internal-releases/:_authToken=${CLOUDSMITH_API_KEY} + - name: Install node modules + run: npm ci - name: Find components affected by changes id: percy-changes run: | @@ -91,7 +98,14 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - run: npm ci + - name: Configure Cloudsmith + env: + CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} + run: | + npm config set registry=https://npm.packages.ft.com/financial-times-internal-releases/ + npm config set //npm.packages.ft.com/financial-times-internal-releases/:_authToken=${CLOUDSMITH_API_KEY} + - name: Install node modules + run: npm ci - name: Start Percy check env: PERCY_TOKEN: ${{ secrets[matrix.token_name] }} diff --git a/templates/test-workflow.yml b/templates/test-workflow.yml index 5cadd43a62..d0bd6e0bbb 100644 --- a/templates/test-workflow.yml +++ b/templates/test-workflow.yml @@ -42,7 +42,14 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - run: npm ci + - name: Configure Cloudsmith + env: + CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} + run: | + npm config set registry=https://npm.packages.ft.com/financial-times-internal-releases/ + npm config set //npm.packages.ft.com/financial-times-internal-releases/:_authToken=${CLOUDSMITH_API_KEY} + - name: Install node modules + run: npm ci - run: npm run -w ${{ matrix.component }} lint --if-present - run: npm run -w ${{ matrix.component }} build --if-present - run: npm run -w ${{ matrix.component }} test --if-present