Skip to content

Commit 18e5401

Browse files
committed
better setup
1 parent 702250d commit 18e5401

File tree

2 files changed

+6
-83
lines changed

2 files changed

+6
-83
lines changed

.github/actions/js/setup/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ runs:
1515
uses: actions/setup-node@v4
1616
with:
1717
node-version: '22.11.0'
18+
registry-url: 'https://registry.npmjs.org'
1819
cache: 'yarn'
1920

2021
- name: 'Cache Cypress binary'

.github/workflows/components-test-build-deploy.yaml

Lines changed: 5 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,7 @@ jobs:
4444
runs-on: 'ubuntu-24.04'
4545
steps:
4646
- uses: 'actions/checkout@v4'
47-
- uses: 'actions/setup-node@v4'
48-
with:
49-
node-version: '22.11.0'
50-
- name: 'install udev for usb-detection'
51-
run: |
52-
# WORKAROUND: Remove microsoft debian repo due to https://github.com/microsoft/linux-package-repositories/issues/130. Remove line below after it is resolved
53-
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
54-
sudo apt-get update && sudo apt-get install libudev-dev
55-
- name: 'cache yarn cache'
56-
uses: actions/cache@v4
57-
with:
58-
path: |
59-
${{ github.workspace }}/.yarn-cache
60-
${{ github.workspace }}/.npm-cache
61-
key: js-${{ secrets.GH_CACHE_VERSION }}-${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
62-
restore-keys: |
63-
js-${{ secrets.GH_CACHE_VERSION }}-${{ runner.os }}-yarn-
64-
- name: 'setup-js'
65-
run: |
66-
npm config set cache ./.npm-cache
67-
make setup-js
47+
- uses: ./.github/actions/js/setup
6848
- name: 'run components unit tests'
6949
run: make -C components test-cov
7050
- name: 'Upload coverage report'
@@ -80,28 +60,7 @@ jobs:
8060
needs: ['js-unit-test']
8161
steps:
8262
- uses: 'actions/checkout@v4'
83-
- uses: 'actions/setup-node@v4'
84-
with:
85-
node-version: '22.11.0'
86-
- name: 'install udev for usb-detection'
87-
run: |
88-
# WORKAROUND: Remove microsoft debian repo due to https://github.com/microsoft/linux-package-repositories/issues/130. Remove line below after it is resolved
89-
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
90-
sudo apt-get update && sudo apt-get install libudev-dev
91-
- name: 'cache yarn cache'
92-
uses: actions/cache@v4
93-
with:
94-
path: |
95-
${{ github.workspace }}/.yarn-cache
96-
${{ github.workspace }}/.npm-cache
97-
key: js-${{ secrets.GH_CACHE_VERSION }}-${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
98-
restore-keys: |
99-
js-${{ secrets.GH_CACHE_VERSION }}-${{ runner.os }}-yarn-
100-
- name: 'setup-js'
101-
run: |
102-
npm config set cache ./.npm-cache
103-
yarn config set cache-folder ./.yarn-cache
104-
make setup-js
63+
- uses: ./.github/actions/js/setup
10564
- name: 'build components'
10665
run: make -C components
10766
- name: 'upload github artifact'
@@ -141,22 +100,7 @@ jobs:
141100
if: needs.determine-build-type.outputs.type != 'none'
142101
steps:
143102
- uses: 'actions/checkout@v4'
144-
# https://github.com/actions/checkout/issues/290
145-
- name: 'Fix actions/checkout odd handling of tags'
146-
if: startsWith(github.ref, 'refs/tags')
147-
run: |
148-
git fetch -f origin ${{ github.ref }}:${{ github.ref }}
149-
git checkout ${{ github.ref }}
150-
- uses: 'actions/setup-node@v4'
151-
with:
152-
node-version: '22.11.0'
153-
- name: 'set complex environment variables'
154-
id: 'set-vars'
155-
uses: actions/github-script@v6
156-
with:
157-
script: |
158-
const { buildComplexEnvVars } = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/utils.js`)
159-
buildComplexEnvVars(core, context)
103+
- uses: ./.github/actions/js/setup
160104
- name: 'download components build'
161105
uses: 'actions/download-artifact@v4'
162106
with:
@@ -181,26 +125,7 @@ jobs:
181125
if: needs.determine-build-type.outputs.type == 'publish'
182126
steps:
183127
- uses: 'actions/checkout@v4'
184-
# https://github.com/actions/checkout/issues/290
185-
- name: 'Fix actions/checkout odd handling of tags'
186-
if: startsWith(github.ref, 'refs/tags')
187-
run: |
188-
git fetch -f origin ${{ github.ref }}:${{ github.ref }}
189-
git checkout ${{ github.ref }}
190-
- uses: 'actions/setup-node@v4'
191-
with:
192-
node-version: '22.11.0'
193-
registry-url: 'https://registry.npmjs.org'
194-
- name: 'install udev for usb-detection'
195-
run: |
196-
# WORKAROUND: Remove microsoft debian repo due to https://github.com/microsoft/linux-package-repositories/issues/130. Remove line below after it is resolved
197-
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
198-
sudo apt-get update && sudo apt-get install libudev-dev
199-
- name: 'setup-js'
200-
run: |
201-
npm config set cache ./.npm-cache
202-
yarn config set cache-folder ./.yarn-cache
203-
make setup-js
128+
- uses: ./.github/actions/js/setup
204129
- name: 'build typescript types'
205130
run: make -C components build-ts
206131
# replace package.json stub version number with version from tag
@@ -211,10 +136,7 @@ jobs:
211136
json -I -f ./components/package.json -e "this.version=\"$VERSION_STRING\""
212137
json -I -f ./components/package.json -e "this.dependencies['@opentrons/shared-data']=\"$VERSION_STRING\""
213138
json -I -f ./components/package.json -e "delete this.dependencies['@opentrons/step-generation']"
214-
- uses: 'actions/setup-node@v4'
215-
with:
216-
node-version: '22.11.0'
217-
registry-url: 'https://registry.npmjs.org'
139+
218140
- name: 'publish to npm registry'
219141
env:
220142
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)