Skip to content

Commit 42c2b82

Browse files
committed
Auto-generated commit
1 parent fd2ab40 commit 42c2b82

File tree

6 files changed

+170
-65
lines changed

6 files changed

+170
-65
lines changed

.github/.keepalive

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/productionize.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ on:
3434
type: boolean
3535
default: true
3636

37+
# Run workflow upon completion of `publish` workflow run:
38+
workflow_run:
39+
workflows: ["publish"]
40+
types: [completed]
41+
42+
3743
# Concurrency group to prevent multiple concurrent executions:
3844
concurrency:
3945
group: productionize

.github/workflows/publish.yml

Lines changed: 105 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,23 @@ name: publish
2121

2222
# Workflow triggers:
2323
on:
24-
# Run workflow when a new tag is pushed to the repository:
25-
push:
26-
tags: v[0-9]+.[0-9]+.[0-9]+
24+
# Allow the workflow to be manually run:
25+
workflow_dispatch:
26+
# Workflow inputs:
27+
inputs:
28+
version:
29+
description: 'Version Increment'
30+
type: choice
31+
default: 'none'
32+
options:
33+
- 'none'
34+
- 'major'
35+
- 'minor'
36+
- 'patch'
37+
- 'premajor'
38+
- 'preminor'
39+
- 'prepatch'
40+
- 'prerelease'
2741

2842
# Workflow jobs:
2943
jobs:
@@ -32,14 +46,15 @@ jobs:
3246
publish:
3347

3448
# Define display name:
35-
name: 'Publish to npm'
49+
name: 'Publish package to npm'
3650

3751
# Define the type of virtual host machine on which to run the job:
3852
runs-on: ubuntu-latest
3953

4054
# Define environment variables:
4155
env:
4256
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
57+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4358

4459
# Define the sequence of job steps...
4560
steps:
@@ -55,6 +70,72 @@ jobs:
5570
node-version: 16
5671
timeout-minutes: 5
5772

73+
# Configure git:
74+
- name: 'Configure git'
75+
run: |
76+
git config --local user.email "noreply@stdlib.io"
77+
git config --local user.name "stdlib-bot"
78+
79+
# Increment package version (if requested):
80+
- name: 'Increment package version (if requested)'
81+
if: ${{ github.event.inputs.version != 'none' }}
82+
run: |
83+
# Save NPM_TOKEN to user's .npmrc:
84+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
85+
86+
# Increment package version:
87+
npm version ${{ github.event.inputs.version }} --no-git-tag-version
88+
89+
# Define variable for new version:
90+
NEW_VERSION=$(node -p "require('./package.json').version")
91+
92+
# Replace branch in README.md link definitions for badges with the new version:
93+
find . -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/branch([=:])[^ ]+/branch\1v${NEW_VERSION}/g"
94+
95+
# Create a new commit and tag:
96+
git add package.json README.md
97+
git commit -m "Release v${NEW_VERSION}"
98+
git tag -a "v${NEW_VERSION}" -m "Release v${NEW_VERSION}"
99+
100+
# Push changes to GitHub:
101+
SLUG=${{ github.repository }}
102+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" --follow-tags
103+
104+
# Remove CLI:
105+
- name: 'Remove CLI'
106+
if: ${{ github.ref == 'refs/heads/main' }}
107+
run: |
108+
rm -rf ./bin/cli
109+
rm test/test.cli.js
110+
rm etc/cli_opts.json
111+
rm docs/usage.txt
112+
113+
# For all dependencies, check in all *.js files if they are still used; if not, remove them:
114+
jq -r '.dependencies | keys[]' ./package.json | while read -r dep; do
115+
dep=$(echo "$dep" | xargs)
116+
if ! grep -q "$dep" lib/**; then
117+
jq --indent 2 "del(.dependencies[\"$dep\"])" ./package.json > ./package.json.tmp
118+
mv ./package.json.tmp ./package.json
119+
fi
120+
done
121+
jq -r '.devDependencies | keys[]' ./package.json | while read -r dep; do
122+
if [[ "$dep" != "@stdlib"* ]]; then
123+
continue
124+
fi
125+
dep=$(echo "$dep" | xargs)
126+
if ! grep -q "$dep" ./lib/**; then
127+
jq --indent 2 "del(.devDependencies[\"$dep\"])" ./package.json > ./package.json.tmp
128+
mv ./package.json.tmp ./package.json
129+
fi
130+
done
131+
132+
# Remove CLI section:
133+
find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?<section class=\"cli\">[\s\S]+?<\!\-\- \/.cli \-\->//"
134+
135+
# Remove CLI from package.json:
136+
jq -r 'del(.bin)' package.json > package.json.tmp
137+
mv package.json.tmp package.json
138+
58139
# Replace GitHub links to individual packages with npm links:
59140
- name: 'Replace all GitHub links to individual packages with npm links'
60141
run: |
@@ -68,7 +149,26 @@ jobs:
68149
# Replace all stdlib GitHub dependencies with the respective npm packages:
69150
- name: 'Replace all stdlib GitHub dependencies with the respective npm packages'
70151
run: |
71-
find package.json -type f -print0 | xargs -0 sed -Ei 's/"github:stdlib-js[^"]*"/"^0.0.x"/g'
152+
for dep in $(jq -r '.dependencies | keys | .[]' package.json); do
153+
if [[ "$dep" != "@stdlib"* ]]; then
154+
continue
155+
fi
156+
# Trim leading and trailing whitespace:
157+
dep=$(echo "$dep" | xargs)
158+
version="^$(npm view $dep version)"
159+
jq -r --arg dep "$dep" --arg version "$version" '.dependencies[$dep] = $version' package.json > package.json.tmp
160+
mv package.json.tmp package.json
161+
done
162+
for dep in $(jq -r '.devDependencies | keys | .[]' package.json); do
163+
if [[ "$dep" != "@stdlib"* ]]; then
164+
continue
165+
fi
166+
# Trim leading and trailing whitespace:
167+
dep=$(echo "$dep" | xargs)
168+
version="^$(npm view $dep version)"
169+
jq -r --arg dep "$dep" --arg version "$version" '.devDependencies[$dep] = $version' package.json > package.json.tmp
170+
mv package.json.tmp package.json
171+
done
72172
73173
# Publish package to npm:
74174
- name: 'Publish package to npm'

branches.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ C -->|bundle| D[esm];
3838
C -->|bundle| E[deno];
3939
C -->|bundle| F[umd];
4040
41-
click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/ones-like"
42-
click B href "https://github.com/stdlib-js/array-ones-like/tree/main"
43-
click C href "https://github.com/stdlib-js/array-ones-like/tree/production"
44-
click D href "https://github.com/stdlib-js/array-ones-like/tree/esm"
45-
click E href "https://github.com/stdlib-js/array-ones-like/tree/deno"
46-
click F href "https://github.com/stdlib-js/array-ones-like/tree/umd"
41+
%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/ones-like"
42+
%% click B href "https://github.com/stdlib-js/array-ones-like/tree/main"
43+
%% click C href "https://github.com/stdlib-js/array-ones-like/tree/production"
44+
%% click D href "https://github.com/stdlib-js/array-ones-like/tree/esm"
45+
%% click E href "https://github.com/stdlib-js/array-ones-like/tree/deno"
46+
%% click F href "https://github.com/stdlib-js/array-ones-like/tree/umd"
4747
```
4848

4949
[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/ones-like

package.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,35 +37,35 @@
3737
"url": "https://github.com/stdlib-js/stdlib/issues"
3838
},
3939
"dependencies": {
40-
"@stdlib/array-dtype": "^0.0.x",
41-
"@stdlib/array-full": "^0.0.x",
42-
"@stdlib/complex-float32": "^0.0.x",
43-
"@stdlib/complex-float64": "^0.0.x",
44-
"@stdlib/string-format": "^0.0.x",
45-
"@stdlib/types": "^0.0.x"
40+
"@stdlib/array-dtype": "^0.0.6",
41+
"@stdlib/array-full": "^0.0.1",
42+
"@stdlib/complex-float32": "^0.0.7",
43+
"@stdlib/complex-float64": "^0.0.8",
44+
"@stdlib/string-format": "^0.0.3",
45+
"@stdlib/types": "^0.0.14"
4646
},
4747
"devDependencies": {
48-
"@stdlib/array-complex128": "^0.0.x",
49-
"@stdlib/array-complex64": "^0.0.x",
50-
"@stdlib/array-dtypes": "^0.0.x",
51-
"@stdlib/array-float32": "^0.0.x",
52-
"@stdlib/array-float64": "^0.0.x",
53-
"@stdlib/array-int16": "^0.0.x",
54-
"@stdlib/array-int32": "^0.0.x",
55-
"@stdlib/array-int8": "^0.0.x",
56-
"@stdlib/array-uint16": "^0.0.x",
57-
"@stdlib/array-uint32": "^0.0.x",
58-
"@stdlib/array-uint8": "^0.0.x",
59-
"@stdlib/array-uint8c": "^0.0.x",
60-
"@stdlib/array-zeros": "^0.0.x",
61-
"@stdlib/assert-instance-of": "^0.0.x",
62-
"@stdlib/assert-is-array": "^0.0.x",
63-
"@stdlib/assert-is-typed-array": "^0.0.x",
64-
"@stdlib/assert-is-typed-array-like": "^0.0.x",
65-
"@stdlib/bench": "^0.0.x",
66-
"@stdlib/math-base-special-pow": "^0.0.x",
67-
"@stdlib/strided-base-reinterpret-complex128": "^0.0.x",
68-
"@stdlib/strided-base-reinterpret-complex64": "^0.0.x",
48+
"@stdlib/array-complex128": "^0.0.6",
49+
"@stdlib/array-complex64": "^0.0.6",
50+
"@stdlib/array-dtypes": "^0.0.6",
51+
"@stdlib/array-float32": "^0.0.6",
52+
"@stdlib/array-float64": "^0.0.6",
53+
"@stdlib/array-int16": "^0.0.6",
54+
"@stdlib/array-int32": "^0.0.6",
55+
"@stdlib/array-int8": "^0.0.6",
56+
"@stdlib/array-uint16": "^0.0.6",
57+
"@stdlib/array-uint32": "^0.0.6",
58+
"@stdlib/array-uint8": "^0.0.7",
59+
"@stdlib/array-uint8c": "^0.0.8",
60+
"@stdlib/array-zeros": "^0.0.1",
61+
"@stdlib/assert-instance-of": "^0.0.8",
62+
"@stdlib/assert-is-array": "^0.0.7",
63+
"@stdlib/assert-is-typed-array": "^0.0.6",
64+
"@stdlib/assert-is-typed-array-like": "^0.0.8",
65+
"@stdlib/bench": "^0.0.12",
66+
"@stdlib/math-base-special-pow": "^0.0.7",
67+
"@stdlib/strided-base-reinterpret-complex128": "^0.0.2",
68+
"@stdlib/strided-base-reinterpret-complex64": "^0.0.2",
6969
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
7070
"istanbul": "^0.4.1",
7171
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
@@ -141,7 +141,7 @@
141141
"ones"
142142
],
143143
"funding": {
144-
"type": "patreon",
145-
"url": "https://www.patreon.com/athan"
144+
"type": "opencollective",
145+
"url": "https://opencollective.com/stdlib"
146146
}
147147
}

0 commit comments

Comments
 (0)