| 
29 | 29 |   # Allow the workflow to be manually run:  | 
30 | 30 |   workflow_dispatch:  | 
31 | 31 | 
 
  | 
 | 32 | +# Concurrency group to prevent multiple concurrent executions:  | 
 | 33 | +concurrency:  | 
 | 34 | +  group: productionize  | 
 | 35 | +  cancel-in-progress: true  | 
 | 36 | + | 
32 | 37 | # Workflow jobs:  | 
33 | 38 | jobs:  | 
34 | 39 | 
 
  | 
@@ -170,8 +175,8 @@ jobs:  | 
170 | 175 |     # Define the type of virtual host machine on which to run the job:  | 
171 | 176 |     runs-on: ubuntu-latest  | 
172 | 177 | 
 
  | 
173 |  | -    # Indicate that this job depends on the prior job finishing:  | 
174 |  | -    needs: productionize  | 
 | 178 | +    # Indicate that this job depends on the test job finishing:  | 
 | 179 | +    needs: test  | 
175 | 180 | 
 
  | 
176 | 181 |     # Define the sequence of job steps...  | 
177 | 182 |     steps:  | 
@@ -336,8 +341,8 @@ jobs:  | 
336 | 341 |     # Define the type of virtual host machine on which to run the job:  | 
337 | 342 |     runs-on: ubuntu-latest  | 
338 | 343 | 
 
  | 
339 |  | -    # Indicate that this job depends on the prior job finishing:  | 
340 |  | -    needs: productionize  | 
 | 344 | +    # Indicate that this job depends on the test job finishing:  | 
 | 345 | +    needs: test  | 
341 | 346 | 
 
  | 
342 | 347 |     # Define the sequence of job steps...  | 
343 | 348 |     steps:  | 
@@ -500,8 +505,8 @@ jobs:  | 
500 | 505 |     # Define the type of virtual host machine on which to run the job:  | 
501 | 506 |     runs-on: ubuntu-latest  | 
502 | 507 | 
 
  | 
503 |  | -    # Indicate that this job depends on the prior job finishing:  | 
504 |  | -    needs: productionize  | 
 | 508 | +    # Indicate that this job depends on the test job finishing:  | 
 | 509 | +    needs: test  | 
505 | 510 | 
 
  | 
506 | 511 |     # Define the sequence of job steps...  | 
507 | 512 |     steps:  | 
@@ -662,30 +667,94 @@ jobs:  | 
662 | 667 |         if: failure()  | 
663 | 668 | 
 
  | 
664 | 669 |   # Define job that succeeds if all bundles were successfully built:  | 
665 |  | -  productionize-status:  | 
 | 670 | +  create-tag-bundles:  | 
666 | 671 | 
 
  | 
667 | 672 |     # Define display name:  | 
668 |  | -    name: 'Productionize status'  | 
 | 673 | +    name: 'Create tag bundles'  | 
669 | 674 | 
 
  | 
670 | 675 |     # Define the type of virtual host machine on which to run the job:  | 
671 | 676 |     runs-on: ubuntu-latest  | 
672 | 677 | 
 
  | 
673 |  | -    # Indicate that this job depends on the prior jobs finishing:  | 
 | 678 | +    # Indicate that this job depends on the bundle jobs finishing:  | 
674 | 679 |     needs: [ deno, umd, esm ]  | 
675 | 680 | 
 
  | 
676 | 681 |     # Define the steps to be executed:  | 
677 | 682 |     steps:  | 
678 | 683 | 
 
  | 
679 |  | -      - name: 'If all bundles were successfully generated...'  | 
680 |  | -        if: always() && (needs.deno.result == 'success' && needs.umd.result == 'success' && needs.esm.result == 'success')  | 
 | 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  | 
681 | 694 |         run: |  | 
682 |  | -          echo "All bundles were successfully built."  | 
683 |  | -          echo "Success!"  | 
684 |  | -          exit 0  | 
 | 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  | 
685 | 703 | 
  | 
686 |  | -      - name: 'If any bundle failed to be generated...'  | 
687 |  | -        if: always() && (needs.deno.result == 'failure' || needs.umd.result == 'failure' || needs.esm.result == 'failure')  | 
 | 704 | +      # Configure git:  | 
 | 705 | +      - name: 'Configure git'  | 
 | 706 | +        if: steps.check-if-bump.outputs.bump  | 
688 | 707 |         run: |  | 
689 |  | -          echo "One or more bundles failed to be generated."  | 
690 |  | -          echo "Failure!"  | 
691 |  | -          exit 1  | 
 | 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  | 
0 commit comments