From 6418065928e682230f5ac3c60994533bb55e3c5a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Aug 2022 01:04:22 +0000 Subject: [PATCH] Auto-generated commit --- .github/.keepalive | 1 + .github/workflows/productionize.yml | 165 ++++++++++++++++++++-------- .github/workflows/test.yml | 2 +- .github/workflows/test_coverage.yml | 2 +- CONTRIBUTORS | 1 + 5 files changed, 123 insertions(+), 48 deletions(-) create mode 100644 .github/.keepalive diff --git a/.github/.keepalive b/.github/.keepalive new file mode 100644 index 0000000..bc24a88 --- /dev/null +++ b/.github/.keepalive @@ -0,0 +1 @@ +2022-08-01T01:04:21.952Z diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml index 6726965..5094681 100644 --- a/.github/workflows/productionize.yml +++ b/.github/workflows/productionize.yml @@ -21,12 +21,19 @@ name: productionize # Workflow triggers: on: - # Run workflow when a new commit is pushed to the repository: + # Run workflow when a new commit is pushed to the main branch: push: + branches: + - main # Allow the workflow to be manually run: workflow_dispatch: +# Concurrency group to prevent multiple concurrent executions: +concurrency: + group: productionize + cancel-in-progress: true + # Workflow jobs: jobs: @@ -168,8 +175,8 @@ jobs: # Define the type of virtual host machine on which to run the job: runs-on: ubuntu-latest - # Indicate that this job depends on the prior job finishing: - needs: productionize + # Indicate that this job depends on the test job finishing: + needs: test # Define the sequence of job steps... steps: @@ -309,21 +316,12 @@ jobs: git add -A git commit -m "Auto-generated commit" - # Push changes to `deno` branch or create new branch tag: - - name: 'Push changes to `deno` branch or create new branch tag' + # Push changes to `deno` branch: + - name: 'Push changes to `deno` branch' run: | SLUG=${{ github.repository }} - VERSION=$(echo ${{ github.ref }} | sed -E -n 's/refs\/tags\/?(v[0-9]+.[0-9]+.[0-9]+).*/\1/p') - if [ -z "$VERSION" ]; then - echo "Workflow job was not triggered by a new tag...." - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - else - echo "Workflow job was triggered by a new tag: $VERSION" - echo "Creating new bundle branch tag of the form $VERSION-deno" - git tag -a $VERSION-deno -m "$VERSION-deno" - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-deno - fi + echo "Pushing changes to $SLUG..." + git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' @@ -343,8 +341,8 @@ jobs: # Define the type of virtual host machine on which to run the job: runs-on: ubuntu-latest - # Indicate that this job depends on the prior job finishing: - needs: productionize + # Indicate that this job depends on the test job finishing: + needs: test # Define the sequence of job steps... steps: @@ -482,21 +480,12 @@ jobs: git add -A git commit -m "Auto-generated commit" - # Push changes to `umd` branch or create new branch tag: - - name: 'Push changes to `umd` branch or create new branch tag' + # Push changes to `umd` branch: + - name: 'Push changes to `umd` branch' run: | SLUG=${{ github.repository }} - VERSION=$(echo ${{ github.ref }} | sed -E -n 's/refs\/tags\/?(v[0-9]+.[0-9]+.[0-9]+).*/\1/p') - if [ -z "$VERSION" ]; then - echo "Workflow job was not triggered by a new tag...." - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" umd - else - echo "Workflow job was triggered by a new tag: $VERSION" - echo "Creating new bundle branch tag of the form $VERSION-umd" - git tag -a $VERSION-umd -m "$VERSION-umd" - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-umd - fi + echo "Pushing changes to $SLUG..." + git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" umd # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' @@ -516,8 +505,8 @@ jobs: # Define the type of virtual host machine on which to run the job: runs-on: ubuntu-latest - # Indicate that this job depends on the prior job finishing: - needs: productionize + # Indicate that this job depends on the test job finishing: + needs: test # Define the sequence of job steps... steps: @@ -661,21 +650,12 @@ jobs: git add -A git commit -m "Auto-generated commit" - # Push changes to `esm` branch or create new branch tag: - - name: 'Push changes to `esm` branch or create new branch tag' + # Push changes to `esm` branch: + - name: 'Push changes to `esm` branch' run: | SLUG=${{ github.repository }} - VERSION=$(echo ${{ github.ref }} | sed -E -n 's/refs\/tags\/?(v[0-9]+.[0-9]+.[0-9]+).*/\1/p') - if [ -z "$VERSION" ]; then - echo "Workflow job was not triggered by a new tag...." - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" esm - else - echo "Workflow job was triggered by a new tag: $VERSION" - echo "Creating new bundle branch tag of the form $VERSION-esm" - git tag -a $VERSION-esm -m "$VERSION-esm" - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-esm - fi + echo "Pushing changes to $SLUG..." + git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" esm # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' @@ -685,3 +665,96 @@ jobs: steps: ${{ toJson(steps) }} channel: '#npm-ci' if: failure() + + # Define job that succeeds if all bundles were successfully built: + create-tag-bundles: + + # Define display name: + name: 'Create tag bundles' + + # Define the type of virtual host machine on which to run the job: + runs-on: ubuntu-latest + + # Indicate that this job depends on the bundle jobs finishing: + needs: [ deno, umd, esm ] + + # Define the steps to be executed: + steps: + + # Checkout the repository: + - name: 'Checkout repository' + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + # Check if workflow run was triggered by a patch, minor, or major version bump: + - name: 'Check if workflow run was triggered by a patch, minor, or major version bump' + id: check-if-bump + continue-on-error: true + run: | + VERSION_CHANGE_PKG_JSON=$(git diff HEAD~1 HEAD package.json | grep '"version":') + if [ -z "$VERSION_CHANGE_PKG_JSON" ]; then + echo "This workflow was not triggered by a version bump." + echo "::set-output name=bump::false" + else + echo "This workflow was triggered by a version bump." + echo "::set-output name=bump::true" + fi + + # Configure git: + - name: 'Configure git' + if: steps.check-if-bump.outputs.bump + run: | + git config --local user.email "noreply@stdlib.io" + git config --local user.name "stdlib-bot" + git fetch --all + + # Create bundle tags: + - name: 'Create bundle tags' + if: steps.check-if-bump.outputs.bump + run: | + SLUG=${{ github.repository }} + ESCAPED=$(echo $SLUG | sed -E 's/\//\\\//g') + VERSION="v$(jq --raw-output '.version' package.json)" + + git checkout -b deno origin/deno + sed -i -E "s/$ESCAPED@deno/$ESCAPED@$VERSION-deno/g" README.md + git add README.md + git commit -m "Update README.md for Deno bundle $VERSION" + git tag -a $VERSION-deno -m "$VERSION-deno" + git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-deno + sed -i -E "s/$ESCAPED@$VERSION-deno/$ESCAPED@deno/g" README.md + + 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 + + git add README.md + git commit -m "Auto-generated commit" + git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno + + git checkout -b umd origin/umd + sed -i -E "s/$ESCAPED@umd/$ESCAPED@$VERSION-umd/g" README.md + git add README.md + git commit -m "Update README.md for UMD bundle $VERSION" + git tag -a $VERSION-umd -m "$VERSION-umd" + git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-umd + sed -i -E "s/$ESCAPED@$VERSION-umd/$ESCAPED@umd/g" README.md + + 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 + + git add README.md + git commit -m "Auto-generated commit" + git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" umd + + git checkout -b esm origin/esm + sed -i -E "s/$ESCAPED@esm/$ESCAPED@$VERSION-esm/g" README.md + git add README.md + git commit -m "Update README.md for ESM bundle $VERSION" + git tag -a $VERSION-esm -m "$VERSION-esm" + git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-esm + sed -i -E "s/$ESCAPED@$VERSION-esm/$ESCAPED@esm/g" README.md + + 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 + + git add README.md + git commit -m "Auto-generated commit" + git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" esm diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 17ace3f..db4c5e7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,7 +29,7 @@ on: # Allow the workflow to be manually run: workflow_dispatch: - # Run workflow on each push: + # Run workflow on each push to the main branch: push: # Workflow jobs: diff --git a/.github/workflows/test_coverage.yml b/.github/workflows/test_coverage.yml index a8f3eb5..be781ee 100644 --- a/.github/workflows/test_coverage.yml +++ b/.github/workflows/test_coverage.yml @@ -77,7 +77,7 @@ jobs: # Upload coverage report to Codecov: - name: 'Upload coverage to Codecov' id: upload - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: directory: reports/coverage flags: unittests diff --git a/CONTRIBUTORS b/CONTRIBUTORS index e5c896d..e51ca99 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -24,5 +24,6 @@ Ricky Reusser Ryan Seal Seyyed Parsa Neshaei Shraddheya Shendre +Stephannie Jimenez Gacha dorrin-sot <59933477+dorrin-sot@users.noreply.github.com> rei2hu