Skip to content

Commit 85d305a

Browse files
committed
Auto-generated commit
1 parent d20a298 commit 85d305a

File tree

6 files changed

+148
-108
lines changed

6 files changed

+148
-108
lines changed

.github/.keepalive

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-07-01T00:34:24.795Z
1+
2022-08-01T00:37:58.938Z

.github/workflows/productionize.yml

Lines changed: 144 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,19 @@ name: productionize
2121

2222
# Workflow triggers:
2323
on:
24-
# Run workflow when a new commit is pushed to the repository:
24+
# Run workflow when a new commit is pushed to the main branch:
2525
push:
26+
branches:
27+
- main
2628

2729
# Allow the workflow to be manually run:
2830
workflow_dispatch:
2931

32+
# Concurrency group to prevent multiple concurrent executions:
33+
concurrency:
34+
group: productionize
35+
cancel-in-progress: true
36+
3037
# Workflow jobs:
3138
jobs:
3239

@@ -168,8 +175,8 @@ jobs:
168175
# Define the type of virtual host machine on which to run the job:
169176
runs-on: ubuntu-latest
170177

171-
# Indicate that this job depends on the prior job finishing:
172-
needs: productionize
178+
# Indicate that this job depends on the test job finishing:
179+
needs: test
173180

174181
# Define the sequence of job steps...
175182
steps:
@@ -202,13 +209,15 @@ jobs:
202209
run: |
203210
git checkout -b deno origin/deno
204211
205-
find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs rm
206-
find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs rm -rf
212+
find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm
213+
find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf
207214
208215
git add -A
209-
git commit -m "Remove files"
216+
git commit -m "Remove files" --allow-empty
210217
211-
git merge -s recursive -X theirs origin/production --allow-unrelated-histories
218+
git config merge.theirs.name 'simulate `-s theirs`'
219+
git config merge.theirs.driver 'cat %B > %A'
220+
GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories
212221
213222
# If `deno` does not exist, create `deno` branch:
214223
- name: 'If `deno` does not exist, create `deno` branch'
@@ -292,8 +301,8 @@ jobs:
292301
# Delete everything in current directory aside from deno folder:
293302
- name: 'Delete everything in current directory aside from deno folder'
294303
run: |
295-
find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs rm
296-
find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs rm -rf
304+
find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm
305+
find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf
297306
298307
# Move deno directory to root:
299308
- name: 'Move deno directory to root'
@@ -307,21 +316,12 @@ jobs:
307316
git add -A
308317
git commit -m "Auto-generated commit"
309318
310-
# Push changes to `deno` branch or create new branch tag:
311-
- name: 'Push changes to `deno` branch or create new branch tag'
319+
# Push changes to `deno` branch:
320+
- name: 'Push changes to `deno` branch'
312321
run: |
313322
SLUG=${{ github.repository }}
314-
VERSION=$(echo ${{ github.ref }} | sed -E -n 's/refs\/tags\/?(v[0-9]+.[0-9]+.[0-9]+).*/\1/p')
315-
if [ -z "$VERSION" ]; then
316-
echo "Workflow job was not triggered by a new tag...."
317-
echo "Pushing changes to $SLUG..."
318-
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno
319-
else
320-
echo "Workflow job was triggered by a new tag: $VERSION"
321-
echo "Creating new bundle branch tag of the form $VERSION-deno"
322-
git tag -a $VERSION-deno -m "$VERSION-deno"
323-
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-deno
324-
fi
323+
echo "Pushing changes to $SLUG..."
324+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno
325325
326326
# Send status to Slack channel if job fails:
327327
- name: 'Send status to Slack channel in case of failure'
@@ -341,8 +341,8 @@ jobs:
341341
# Define the type of virtual host machine on which to run the job:
342342
runs-on: ubuntu-latest
343343

344-
# Indicate that this job depends on the prior job finishing:
345-
needs: productionize
344+
# Indicate that this job depends on the test job finishing:
345+
needs: test
346346

347347
# Define the sequence of job steps...
348348
steps:
@@ -375,13 +375,15 @@ jobs:
375375
run: |
376376
git checkout -b umd origin/umd
377377
378-
find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs rm
379-
find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs rm -rf
378+
find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm
379+
find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf
380380
381381
git add -A
382-
git commit -m "Remove files"
382+
git commit -m "Remove files" --allow-empty
383383
384-
git merge -s recursive -X theirs origin/production --allow-unrelated-histories
384+
git config merge.theirs.name 'simulate `-s theirs`'
385+
git config merge.theirs.driver 'cat %B > %A'
386+
GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories
385387
386388
# If `umd` does not exist, create `umd` branch:
387389
- name: 'If `umd` does not exist, create `umd` branch'
@@ -458,13 +460,13 @@ jobs:
458460
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<script type=\"text\/javascript\">([\s\S]+?)<\/script>/<script type=\"text\/javascript\">\n\(function \(\) {\1}\)\(\);\n<\/script>/g"
459461
460462
# Create package.json file for umd branch:
461-
jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "main": "./browser.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./umd/package.json
463+
jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "main": "./index.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./umd/package.json
462464
463465
# Delete everything in current directory aside from umd folder:
464466
- name: 'Delete everything in current directory aside from umd folder'
465467
run: |
466-
find . -type 'f' | grep -v -e "umd" -e ".git/" | xargs rm
467-
find . -mindepth 1 -type 'd' | grep -v -e "umd" -e ".git" | xargs rm -rf
468+
find . -type 'f' | grep -v -e "umd" -e ".git/" | xargs -r rm
469+
find . -mindepth 1 -type 'd' | grep -v -e "umd" -e ".git" | xargs -r rm -rf
468470
469471
# Move umd directory to root:
470472
- name: 'Move umd directory to root'
@@ -478,21 +480,12 @@ jobs:
478480
git add -A
479481
git commit -m "Auto-generated commit"
480482
481-
# Push changes to `umd` branch or create new branch tag:
482-
- name: 'Push changes to `umd` branch or create new branch tag'
483+
# Push changes to `umd` branch:
484+
- name: 'Push changes to `umd` branch'
483485
run: |
484486
SLUG=${{ github.repository }}
485-
VERSION=$(echo ${{ github.ref }} | sed -E -n 's/refs\/tags\/?(v[0-9]+.[0-9]+.[0-9]+).*/\1/p')
486-
if [ -z "$VERSION" ]; then
487-
echo "Workflow job was not triggered by a new tag...."
488-
echo "Pushing changes to $SLUG..."
489-
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" umd
490-
else
491-
echo "Workflow job was triggered by a new tag: $VERSION"
492-
echo "Creating new bundle branch tag of the form $VERSION-umd"
493-
git tag -a $VERSION-umd -m "$VERSION-umd"
494-
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-umd
495-
fi
487+
echo "Pushing changes to $SLUG..."
488+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" umd
496489
497490
# Send status to Slack channel if job fails:
498491
- name: 'Send status to Slack channel in case of failure'
@@ -512,8 +505,8 @@ jobs:
512505
# Define the type of virtual host machine on which to run the job:
513506
runs-on: ubuntu-latest
514507

515-
# Indicate that this job depends on the prior job finishing:
516-
needs: productionize
508+
# Indicate that this job depends on the test job finishing:
509+
needs: test
517510

518511
# Define the sequence of job steps...
519512
steps:
@@ -546,13 +539,15 @@ jobs:
546539
run: |
547540
git checkout -b esm origin/esm
548541
549-
find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs rm
550-
find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs rm -rf
542+
find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm
543+
find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf
551544
552545
git add -A
553-
git commit -m "Remove files"
546+
git commit -m "Remove files" --allow-empty
554547
555-
git merge -s recursive -X theirs origin/production --allow-unrelated-histories
548+
git config merge.theirs.name 'simulate `-s theirs`'
549+
git config merge.theirs.driver 'cat %B > %A'
550+
GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories
556551
557552
# If `esm` does not exist, create `esm` branch:
558553
- name: 'If `esm` does not exist, create `esm` branch'
@@ -640,8 +635,8 @@ jobs:
640635
# Delete everything in current directory aside from esm folder:
641636
- name: 'Delete everything in current directory aside from esm folder'
642637
run: |
643-
find . -type 'f' | grep -v -e "esm" -e ".git/" | xargs rm
644-
find . -mindepth 1 -type 'd' | grep -v -e "esm" -e ".git" | xargs rm -rf
638+
find . -type 'f' | grep -v -e "esm" -e ".git/" | xargs -r rm
639+
find . -mindepth 1 -type 'd' | grep -v -e "esm" -e ".git" | xargs -r rm -rf
645640
646641
# Move esm directory to root:
647642
- name: 'Move esm directory to root'
@@ -655,21 +650,12 @@ jobs:
655650
git add -A
656651
git commit -m "Auto-generated commit"
657652
658-
# Push changes to `esm` branch or create new branch tag:
659-
- name: 'Push changes to `esm` branch or create new branch tag'
653+
# Push changes to `esm` branch:
654+
- name: 'Push changes to `esm` branch'
660655
run: |
661656
SLUG=${{ github.repository }}
662-
VERSION=$(echo ${{ github.ref }} | sed -E -n 's/refs\/tags\/?(v[0-9]+.[0-9]+.[0-9]+).*/\1/p')
663-
if [ -z "$VERSION" ]; then
664-
echo "Workflow job was not triggered by a new tag...."
665-
echo "Pushing changes to $SLUG..."
666-
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" esm
667-
else
668-
echo "Workflow job was triggered by a new tag: $VERSION"
669-
echo "Creating new bundle branch tag of the form $VERSION-esm"
670-
git tag -a $VERSION-esm -m "$VERSION-esm"
671-
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-esm
672-
fi
657+
echo "Pushing changes to $SLUG..."
658+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" esm
673659
674660
# Send status to Slack channel if job fails:
675661
- name: 'Send status to Slack channel in case of failure'
@@ -679,3 +665,96 @@ jobs:
679665
steps: ${{ toJson(steps) }}
680666
channel: '#npm-ci'
681667
if: failure()
668+
669+
# Define job that succeeds if all bundles were successfully built:
670+
create-tag-bundles:
671+
672+
# Define display name:
673+
name: 'Create tag bundles'
674+
675+
# Define the type of virtual host machine on which to run the job:
676+
runs-on: ubuntu-latest
677+
678+
# Indicate that this job depends on the bundle jobs finishing:
679+
needs: [ deno, umd, esm ]
680+
681+
# Define the steps to be executed:
682+
steps:
683+
684+
# Checkout the repository:
685+
- name: 'Checkout repository'
686+
uses: actions/checkout@v3
687+
with:
688+
fetch-depth: 2
689+
690+
# Check if workflow run was triggered by a patch, minor, or major version bump:
691+
- name: 'Check if workflow run was triggered by a patch, minor, or major version bump'
692+
id: check-if-bump
693+
continue-on-error: true
694+
run: |
695+
VERSION_CHANGE_PKG_JSON=$(git diff HEAD~1 HEAD package.json | grep '"version":')
696+
if [ -z "$VERSION_CHANGE_PKG_JSON" ]; then
697+
echo "This workflow was not triggered by a version bump."
698+
echo "::set-output name=bump::false"
699+
else
700+
echo "This workflow was triggered by a version bump."
701+
echo "::set-output name=bump::true"
702+
fi
703+
704+
# Configure git:
705+
- name: 'Configure git'
706+
if: steps.check-if-bump.outputs.bump
707+
run: |
708+
git config --local user.email "noreply@stdlib.io"
709+
git config --local user.name "stdlib-bot"
710+
git fetch --all
711+
712+
# Create bundle tags:
713+
- name: 'Create bundle tags'
714+
if: steps.check-if-bump.outputs.bump
715+
run: |
716+
SLUG=${{ github.repository }}
717+
ESCAPED=$(echo $SLUG | sed -E 's/\//\\\//g')
718+
VERSION="v$(jq --raw-output '.version' package.json)"
719+
720+
git checkout -b deno origin/deno
721+
sed -i -E "s/$ESCAPED@deno/$ESCAPED@$VERSION-deno/g" README.md
722+
git add README.md
723+
git commit -m "Update README.md for Deno bundle $VERSION"
724+
git tag -a $VERSION-deno -m "$VERSION-deno"
725+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-deno
726+
sed -i -E "s/$ESCAPED@$VERSION-deno/$ESCAPED@deno/g" README.md
727+
728+
perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\The previous example will load the latest bundled code from the deno branch. Alternatively, you may load a specific version by loading the file from one of the \[tagged bundles\]\(https:\/\/github.com\/$ESCAPED\/tags\). For example,\n\n\`\`\`javascript\nimport \1 from 'https:\/\/cdn\.jsdelivr\.net\/gh\/$ESCAPED\@$VERSION-deno\/mod\.js';\n\`\`\`/" README.md
729+
730+
git add README.md
731+
git commit -m "Auto-generated commit"
732+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno
733+
734+
git checkout -b umd origin/umd
735+
sed -i -E "s/$ESCAPED@umd/$ESCAPED@$VERSION-umd/g" README.md
736+
git add README.md
737+
git commit -m "Update README.md for UMD bundle $VERSION"
738+
git tag -a $VERSION-umd -m "$VERSION-umd"
739+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-umd
740+
sed -i -E "s/$ESCAPED@$VERSION-umd/$ESCAPED@umd/g" README.md
741+
742+
perl -0777 -i -pe "s/\`\`\`javascript\n([a-zA-Z0-9_]+)\s+=\s*require\(\s*'([^']+)'\s*\)\n\`\`\`/\`\`\`javascript\n\1 = require\( '\2' \)\n\`\`\`\n\The previous example will load the latest bundled code from the umd branch. Alternatively, you may load a specific version by loading the file from one of the \[tagged bundles\]\(https:\/\/github.com\/$ESCAPED\/tags\). For example,\n\n\`\`\`javascript\n\1 = require\( 'https:\/\/cdn\.jsdelivr\.net\/gh\/$ESCAPED\@$VERSION-umd\/browser\.js' \)\n\`\`\`/" README.md
743+
744+
git add README.md
745+
git commit -m "Auto-generated commit"
746+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" umd
747+
748+
git checkout -b esm origin/esm
749+
sed -i -E "s/$ESCAPED@esm/$ESCAPED@$VERSION-esm/g" README.md
750+
git add README.md
751+
git commit -m "Update README.md for ESM bundle $VERSION"
752+
git tag -a $VERSION-esm -m "$VERSION-esm"
753+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-esm
754+
sed -i -E "s/$ESCAPED@$VERSION-esm/$ESCAPED@esm/g" README.md
755+
756+
perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the \[tagged bundles\]\(https:\/\/github.com\/$ESCAPED\/tags\). For example,\n\n\`\`\`javascript\nimport \1 from 'https:\/\/cdn\.jsdelivr\.net\/gh\/$ESCAPED\@$VERSION-esm\/index\.mjs';\n\`\`\`/" README.md
757+
758+
git add README.md
759+
git commit -m "Auto-generated commit"
760+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" esm

.github/workflows/publish.yml

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -91,46 +91,6 @@ jobs:
9191
channel: '#npm-ci'
9292
if: failure()
9393

94-
# Define job to increment semver version and commit the changes to main branch...
95-
increment:
96-
97-
# Define the type of virtual host machine on which to run the job:
98-
runs-on: ubuntu-latest
99-
100-
# Define the sequence of job steps...
101-
steps:
102-
103-
# Checkout main branch of repository:
104-
- name: 'Checkout main branch'
105-
uses: actions/checkout@v3
106-
with:
107-
ref: main
108-
109-
# Increment version:
110-
- name: 'Increment version in `package.json` to the version number of the tag'
111-
run: |
112-
VERSION=$(echo ${{ github.ref }} | sed -E 's/refs\/tags\/v?([0-9]+.[0-9]+.[0-9]+).*/\1/')
113-
sed -Ei "s/\"version\": \"[^\"]+\"/\"version\": \"$VERSION\"/g" package.json
114-
115-
# Configure git:
116-
- name: 'Configure git'
117-
run: |
118-
git config --local user.email "noreply@stdlib.io"
119-
git config --local user.name "stdlib-bot"
120-
121-
# Commit changes:
122-
- name: 'Commit changes'
123-
run: |
124-
git add package.json
125-
git commit -m "Auto-generated commit"
126-
127-
# Push changes:
128-
- name: 'Push changes'
129-
run: |
130-
SLUG=${{ github.repository }}
131-
echo "Pushing changes to $SLUG..."
132-
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" main
133-
13494
# Define job to cancel any running or queued workflow runs...
13595
cancel:
13696

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929
# Allow the workflow to be manually run:
3030
workflow_dispatch:
3131

32-
# Run workflow on each push:
32+
# Run workflow on each push to the main branch:
3333
push:
3434

3535
# Workflow jobs:

.github/workflows/test_coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
# Upload coverage report to Codecov:
7878
- name: 'Upload coverage to Codecov'
7979
id: upload
80-
uses: codecov/codecov-action@v2
80+
uses: codecov/codecov-action@v3
8181
with:
8282
directory: reports/coverage
8383
flags: unittests

0 commit comments

Comments
 (0)