-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e857fa6
commit 783dcf8
Showing
5 changed files
with
123 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2022-08-01T00:43:54.064Z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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:[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' | ||
|
@@ -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:[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' | ||
|
@@ -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:[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' | ||
|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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]> |