Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Aug 1, 2022
1 parent e857fa6 commit 783dcf8
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 48 deletions.
1 change: 1 addition & 0 deletions .github/.keepalive
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2022-08-01T00:43:54.064Z
165 changes: 119 additions & 46 deletions .github/workflows/productionize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:[email protected]/$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:[email protected]/$SLUG.git" $VERSION-deno
fi
echo "Pushing changes to $SLUG..."
git push "https://$GITHUB_ACTOR:[email protected]/$SLUG.git" deno
# Send status to Slack channel if job fails:
- name: 'Send status to Slack channel in case of failure'
Expand All @@ -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:
Expand Down Expand Up @@ -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:[email protected]/$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:[email protected]/$SLUG.git" $VERSION-umd
fi
echo "Pushing changes to $SLUG..."
git push "https://$GITHUB_ACTOR:[email protected]/$SLUG.git" umd
# Send status to Slack channel if job fails:
- name: 'Send status to Slack channel in case of failure'
Expand All @@ -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:
Expand Down Expand Up @@ -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:[email protected]/$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:[email protected]/$SLUG.git" $VERSION-esm
fi
echo "Pushing changes to $SLUG..."
git push "https://$GITHUB_ACTOR:[email protected]/$SLUG.git" esm
# Send status to Slack channel if job fails:
- name: 'Send status to Slack channel in case of failure'
Expand All @@ -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 "[email protected]"
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:[email protected]/$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:[email protected]/$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:[email protected]/$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:[email protected]/$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:[email protected]/$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:[email protected]/$SLUG.git" esm
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ Ricky Reusser <[email protected]>
Ryan Seal <[email protected]>
Seyyed Parsa Neshaei <[email protected]>
Shraddheya Shendre <[email protected]>
Stephannie Jimenez Gacha <[email protected]>
dorrin-sot <[email protected]>
rei2hu <[email protected]>

0 comments on commit 783dcf8

Please sign in to comment.