Skip to content

Commit 43d642f

Browse files
committed
Release v0.0.8
1 parent a35418c commit 43d642f

File tree

4 files changed

+122
-50
lines changed

4 files changed

+122
-50
lines changed

.github/workflows/productionize.yml

Lines changed: 118 additions & 46 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:
@@ -309,21 +316,12 @@ jobs:
309316
git add -A
310317
git commit -m "Auto-generated commit"
311318
312-
# Push changes to `deno` branch or create new branch tag:
313-
- name: 'Push changes to `deno` branch or create new branch tag'
319+
# Push changes to `deno` branch:
320+
- name: 'Push changes to `deno` branch'
314321
run: |
315322
SLUG=${{ github.repository }}
316-
VERSION=$(echo ${{ github.ref }} | sed -E -n 's/refs\/tags\/?(v[0-9]+.[0-9]+.[0-9]+).*/\1/p')
317-
if [ -z "$VERSION" ]; then
318-
echo "Workflow job was not triggered by a new tag...."
319-
echo "Pushing changes to $SLUG..."
320-
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno
321-
else
322-
echo "Workflow job was triggered by a new tag: $VERSION"
323-
echo "Creating new bundle branch tag of the form $VERSION-deno"
324-
git tag -a $VERSION-deno -m "$VERSION-deno"
325-
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-deno
326-
fi
323+
echo "Pushing changes to $SLUG..."
324+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno
327325
328326
# Send status to Slack channel if job fails:
329327
- name: 'Send status to Slack channel in case of failure'
@@ -343,8 +341,8 @@ jobs:
343341
# Define the type of virtual host machine on which to run the job:
344342
runs-on: ubuntu-latest
345343

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

349347
# Define the sequence of job steps...
350348
steps:
@@ -482,21 +480,12 @@ jobs:
482480
git add -A
483481
git commit -m "Auto-generated commit"
484482
485-
# Push changes to `umd` branch or create new branch tag:
486-
- name: 'Push changes to `umd` branch or create new branch tag'
483+
# Push changes to `umd` branch:
484+
- name: 'Push changes to `umd` branch'
487485
run: |
488486
SLUG=${{ github.repository }}
489-
VERSION=$(echo ${{ github.ref }} | sed -E -n 's/refs\/tags\/?(v[0-9]+.[0-9]+.[0-9]+).*/\1/p')
490-
if [ -z "$VERSION" ]; then
491-
echo "Workflow job was not triggered by a new tag...."
492-
echo "Pushing changes to $SLUG..."
493-
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" umd
494-
else
495-
echo "Workflow job was triggered by a new tag: $VERSION"
496-
echo "Creating new bundle branch tag of the form $VERSION-umd"
497-
git tag -a $VERSION-umd -m "$VERSION-umd"
498-
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-umd
499-
fi
487+
echo "Pushing changes to $SLUG..."
488+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" umd
500489
501490
# Send status to Slack channel if job fails:
502491
- name: 'Send status to Slack channel in case of failure'
@@ -516,8 +505,8 @@ jobs:
516505
# Define the type of virtual host machine on which to run the job:
517506
runs-on: ubuntu-latest
518507

519-
# Indicate that this job depends on the prior job finishing:
520-
needs: productionize
508+
# Indicate that this job depends on the test job finishing:
509+
needs: test
521510

522511
# Define the sequence of job steps...
523512
steps:
@@ -661,21 +650,12 @@ jobs:
661650
git add -A
662651
git commit -m "Auto-generated commit"
663652
664-
# Push changes to `esm` branch or create new branch tag:
665-
- name: 'Push changes to `esm` branch or create new branch tag'
653+
# Push changes to `esm` branch:
654+
- name: 'Push changes to `esm` branch'
666655
run: |
667656
SLUG=${{ github.repository }}
668-
VERSION=$(echo ${{ github.ref }} | sed -E -n 's/refs\/tags\/?(v[0-9]+.[0-9]+.[0-9]+).*/\1/p')
669-
if [ -z "$VERSION" ]; then
670-
echo "Workflow job was not triggered by a new tag...."
671-
echo "Pushing changes to $SLUG..."
672-
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" esm
673-
else
674-
echo "Workflow job was triggered by a new tag: $VERSION"
675-
echo "Creating new bundle branch tag of the form $VERSION-esm"
676-
git tag -a $VERSION-esm -m "$VERSION-esm"
677-
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-esm
678-
fi
657+
echo "Pushing changes to $SLUG..."
658+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" esm
679659
680660
# Send status to Slack channel if job fails:
681661
- name: 'Send status to Slack channel in case of failure'
@@ -685,3 +665,95 @@ jobs:
685665
steps: ${{ toJson(steps) }}
686666
channel: '#npm-ci'
687667
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: 3
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+
run: |
694+
VERSION_CHANGE_PKG_JSON=$(git diff HEAD~1 HEAD package.json | grep '"version":')
695+
if [ -z "$VERSION_CHANGE_PKG_JSON" ]; then
696+
echo "This workflow was not triggered by a version bump."
697+
echo "::set-output name=bump::false"
698+
else
699+
echo "This workflow was triggered by a version bump."
700+
echo "::set-output name=bump::true"
701+
fi
702+
703+
# Configure git:
704+
- name: 'Configure git'
705+
if: steps.check-if-bump.outputs.bump
706+
run: |
707+
git config --local user.email "noreply@stdlib.io"
708+
git config --local user.name "stdlib-bot"
709+
git fetch --all
710+
711+
# Create bundle tags:
712+
- name: 'Create bundle tags'
713+
if: steps.check-if-bump.outputs.bump
714+
run: |
715+
SLUG=${{ github.repository }}
716+
ESCAPED=$(echo $SLUG | sed -E 's/\//\\\//g')
717+
VERSION="v$(jq --raw-output '.version' package.json)"
718+
719+
git checkout -b deno origin/deno
720+
sed -i -E "s/$ESCAPED@deno/$ESCAPED@$VERSION-deno/g" README.md
721+
git add README.md
722+
git commit -m "Update README.md for Deno bundle $VERSION"
723+
git tag -a $VERSION-deno -m "$VERSION-deno"
724+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-deno
725+
sed -i -E "s/$ESCAPED@$VERSION-deno/$ESCAPED@deno/g" README.md
726+
727+
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
728+
729+
git add README.md
730+
git commit -m "Auto-generated commit"
731+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno
732+
733+
git checkout -b umd origin/umd
734+
sed -i -E "s/$ESCAPED@umd/$ESCAPED@$VERSION-umd/g" README.md
735+
git add README.md
736+
git commit -m "Update README.md for UMD bundle $VERSION"
737+
git tag -a $VERSION-umd -m "$VERSION-umd"
738+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-umd
739+
sed -i -E "s/$ESCAPED@$VERSION-umd/$ESCAPED@umd/g" README.md
740+
741+
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
742+
743+
git add README.md
744+
git commit -m "Auto-generated commit"
745+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" umd
746+
747+
git checkout -b esm origin/esm
748+
sed -i -E "s/$ESCAPED@esm/$ESCAPED@$VERSION-esm/g" README.md
749+
git add README.md
750+
git commit -m "Update README.md for ESM bundle $VERSION"
751+
git tag -a $VERSION-esm -m "$VERSION-esm"
752+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-esm
753+
sed -i -E "s/$ESCAPED@$VERSION-esm/$ESCAPED@esm/g" README.md
754+
755+
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
756+
757+
git add README.md
758+
git commit -m "Auto-generated commit"
759+
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" esm

.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:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
208208
[npm-image]: http://img.shields.io/npm/v/@stdlib/utils-unshift.svg
209209
[npm-url]: https://npmjs.org/package/@stdlib/utils-unshift
210210

211-
[test-image]: https://github.com/stdlib-js/utils-unshift/actions/workflows/test.yml/badge.svg?branch=main
212-
[test-url]: https://github.com/stdlib-js/utils-unshift/actions/workflows/test.yml?query=branch:main
211+
[test-image]: https://github.com/stdlib-js/utils-unshift/actions/workflows/test.yml/badge.svg?branch=v0.0.8
212+
[test-url]: https://github.com/stdlib-js/utils-unshift/actions/workflows/test.yml?query=branch:v0.0.8
213213

214214
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/utils-unshift/main.svg
215215
[coverage-url]: https://codecov.io/github/stdlib-js/utils-unshift?branch=main

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stdlib/utils-unshift",
3-
"version": "0.0.7",
3+
"version": "0.0.8",
44
"description": "Add one or more elements to the beginning of a collection.",
55
"license": "Apache-2.0",
66
"author": {

0 commit comments

Comments
 (0)