Skip to content

Commit

Permalink
CI: make netlify-cli optional (#3084)
Browse files Browse the repository at this point in the history
Co-authored-by: Phillip Carter <[email protected]>
  • Loading branch information
chalin and cartermp authored Jul 26, 2023
1 parent e9d96b4 commit b38b1e0
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Create NPM cache-hash input file
run: |
mkdir -p tmp
jq '{devDependencies, dependencies, engines}' package.json > tmp/package-ci.json
jq '{devDependencies, dependencies, engines, gitHubActionCacheKey}' package.json > tmp/package-ci.json
- uses: actions/setup-node@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
jq '.devDependencies |= with_entries(
select(.key | test("prefix|hugo|run|css"))
)
| del(.dependencies)' \
| del(.dependencies, .optionalDependencies)' \
package.json > tmp/package-min.json
cp tmp/package-min.json package.json
Expand All @@ -30,7 +30,7 @@ jobs:
cache: npm
cache-dependency-path: tmp/package-ci.json

- run: npm install --no-optional
- run: npm install --omit=optional
- run: npm run build+log
- run: npm run _check:links
continue-on-error: true
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/check-text.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ jobs:
- uses: actions/checkout@v3
# Make sure that we only install the dependencies for textlint to speed up install
- run: |
jq 'del(.dependencies) | .devDependencies |= with_entries( select(.key | startswith("textlint")))' package.json > package2.json && mv package2.json package.json
- run: npm install --ignore-scripts
mkdir -p tmp
jq '.devDependencies |= with_entries( select(.key | startswith("textlint")))
| del(.dependencies, .optionalDependencies)' \
package.json > tmp/package-min.json
cp tmp/package-min.json package.json
- run: npm install --ignore-scripts --omit=optional
- run: .github/workflows/scripts/textlint.sh

markdown-linter:
Expand All @@ -27,8 +31,8 @@ jobs:
jq '.devDependencies |= with_entries(
select(.key | test("gulp|markdown|through|require|yargs"))
)
| del(.dependencies)' \
| del(.dependencies, .optionalDependencies)' \
package.json > tmp/package-min.json
cp tmp/package-min.json package.json
- run: npm install --ignore-scripts
- run: npm install --ignore-scripts --omit=optional
- run: npm run check:markdown
12 changes: 1 addition & 11 deletions .github/workflows/pr-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,12 @@ jobs:
mkdir -p tmp
jq '{devDependencies, dependencies, engines, gitHubActionCacheKey}' package.json > tmp/package-ci.json
# - name: Create and use reduced-dependencies package.json
# run: |
# jq '.devDependencies |= with_entries(
# select(.key | test("prefix|hugo|run|css|prettier"))
# )
# | del(.dependencies)' \
# package.json > tmp/package-min.json
# cp tmp/package-min.json package.json

- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: tmp/package-ci.json

# - run: npm install --no-optional --ignore-scripts
- run: |
npm run format
git status
Expand Down Expand Up @@ -108,7 +98,7 @@ jobs:
cache: npm
cache-dependency-path: tmp/package-ci.json

- run: npm install
- run: npm install --omit=optional
- run: |
npm run check:links
git status
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"fix:filenames": "npm run _rename-to-kebab-case",
"format": "npm run _check:format -- --write",
"get:submodule": "npm run _get:${GET:-submodule}",
"install:netlify-cli": "npm list netlify-cli || npm install netlify-cli",
"make:public": "make public ls-public",
"postbuild:preview": "npm run _check:links--warn",
"postbuild:production": "npm run _check:links--warn",
Expand All @@ -60,7 +61,7 @@
"precheck:links:internal": "npm run build",
"prepare": "run-s get:submodule _prepare:docsy",
"preserve:hugo": "npm run _prebuild",
"preserve:netlify": "npm run _prebuild",
"preserve:netlify": "run-s _prebuild install:netlify-cli",
"s": "run-s",
"schemas:update": "npm run update:submodule content-modules/opentelemetry-specification",
"serve:hugo": "npm run _serve:hugo",
Expand All @@ -70,7 +71,7 @@
"update:pkg:docsy-dep": "npm install --save-dev autoprefixer@latest postcss-cli@latest",
"update:pkg:hugo": "npm install --save-dev --save-exact hugo-extended@latest",
"update:pkg:hugo+": "npm run update:pkg:hugo && npm run update:pkg:docsy-dep",
"update:pkg:netlify": "npm install --save-dev netlify-cli@latest",
"update:pkg:netlify": "npm install --save-optional netlify-cli@latest",
"update:pkg:other": "npm install --save-dev npm-run-all@latest gulp@latest",
"update:submodule:lang": "run-s update:submodule _get:submodule:non-lang",
"update:submodule": "set -x && git submodule update --remote ${DEPTH:- --depth 1}"
Expand All @@ -81,7 +82,6 @@
"gulp": "^4.0.2",
"hugo-extended": "0.115.4",
"markdownlint": "^0.29.0",
"netlify-cli": "^15.9.1",
"npm-run-all": "^4.1.5",
"postcss-cli": "^10.1.0",
"prettier": "^3.0.0",
Expand All @@ -105,6 +105,9 @@
"@opentelemetry/sdk-trace-web": "^1.8.0",
"@opentelemetry/semantic-conventions": "^1.8.0"
},
"optionalDependencies": {
"netlify-cli": "^15.9.1"
},
"enginesComment": "Ensure that engines.node value stays consistent with the project's .nvmrc",
"engines": {
"node": "18.x"
Expand Down

0 comments on commit b38b1e0

Please sign in to comment.