-
-
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
1c323c6
commit 1ee4767
Showing
6 changed files
with
148 additions
and
108 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 |
---|---|---|
@@ -1 +1 @@ | ||
2022-07-01T01:06:30.423Z | ||
2022-08-01T01:09:43.701Z |
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: | ||
|
@@ -202,13 +209,15 @@ jobs: | |
run: | | ||
git checkout -b deno origin/deno | ||
find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs rm | ||
find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs rm -rf | ||
find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm | ||
find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf | ||
git add -A | ||
git commit -m "Remove files" | ||
git commit -m "Remove files" --allow-empty | ||
git merge -s recursive -X theirs origin/production --allow-unrelated-histories | ||
git config merge.theirs.name 'simulate `-s theirs`' | ||
git config merge.theirs.driver 'cat %B > %A' | ||
GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories | ||
# If `deno` does not exist, create `deno` branch: | ||
- name: 'If `deno` does not exist, create `deno` branch' | ||
|
@@ -292,8 +301,8 @@ jobs: | |
# Delete everything in current directory aside from deno folder: | ||
- name: 'Delete everything in current directory aside from deno folder' | ||
run: | | ||
find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs rm | ||
find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs rm -rf | ||
find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm | ||
find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf | ||
# Move deno directory to root: | ||
- name: 'Move deno directory to root' | ||
|
@@ -307,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' | ||
|
@@ -341,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: | ||
|
@@ -375,13 +375,15 @@ jobs: | |
run: | | ||
git checkout -b umd origin/umd | ||
find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs rm | ||
find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs rm -rf | ||
find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm | ||
find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf | ||
git add -A | ||
git commit -m "Remove files" | ||
git commit -m "Remove files" --allow-empty | ||
git merge -s recursive -X theirs origin/production --allow-unrelated-histories | ||
git config merge.theirs.name 'simulate `-s theirs`' | ||
git config merge.theirs.driver 'cat %B > %A' | ||
GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories | ||
# If `umd` does not exist, create `umd` branch: | ||
- name: 'If `umd` does not exist, create `umd` branch' | ||
|
@@ -458,13 +460,13 @@ jobs: | |
find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/<script type=\"text\/javascript\">([\s\S]+?)<\/script>/<script type=\"text\/javascript\">\n\(function \(\) {\1}\)\(\);\n<\/script>/g" | ||
# Create package.json file for umd branch: | ||
jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "main": "./browser.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./umd/package.json | ||
jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "main": "./index.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./umd/package.json | ||
# Delete everything in current directory aside from umd folder: | ||
- name: 'Delete everything in current directory aside from umd folder' | ||
run: | | ||
find . -type 'f' | grep -v -e "umd" -e ".git/" | xargs rm | ||
find . -mindepth 1 -type 'd' | grep -v -e "umd" -e ".git" | xargs rm -rf | ||
find . -type 'f' | grep -v -e "umd" -e ".git/" | xargs -r rm | ||
find . -mindepth 1 -type 'd' | grep -v -e "umd" -e ".git" | xargs -r rm -rf | ||
# Move umd directory to root: | ||
- name: 'Move umd directory to root' | ||
|
@@ -478,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' | ||
|
@@ -512,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: | ||
|
@@ -546,13 +539,15 @@ jobs: | |
run: | | ||
git checkout -b esm origin/esm | ||
find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs rm | ||
find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs rm -rf | ||
find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm | ||
find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf | ||
git add -A | ||
git commit -m "Remove files" | ||
git commit -m "Remove files" --allow-empty | ||
git merge -s recursive -X theirs origin/production --allow-unrelated-histories | ||
git config merge.theirs.name 'simulate `-s theirs`' | ||
git config merge.theirs.driver 'cat %B > %A' | ||
GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories | ||
# If `esm` does not exist, create `esm` branch: | ||
- name: 'If `esm` does not exist, create `esm` branch' | ||
|
@@ -640,8 +635,8 @@ jobs: | |
# Delete everything in current directory aside from esm folder: | ||
- name: 'Delete everything in current directory aside from esm folder' | ||
run: | | ||
find . -type 'f' | grep -v -e "esm" -e ".git/" | xargs rm | ||
find . -mindepth 1 -type 'd' | grep -v -e "esm" -e ".git" | xargs rm -rf | ||
find . -type 'f' | grep -v -e "esm" -e ".git/" | xargs -r rm | ||
find . -mindepth 1 -type 'd' | grep -v -e "esm" -e ".git" | xargs -r rm -rf | ||
# Move esm directory to root: | ||
- name: 'Move esm directory to root' | ||
|
@@ -655,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' | ||
|
@@ -679,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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,46 +91,6 @@ jobs: | |
channel: '#npm-ci' | ||
if: failure() | ||
|
||
# Define job to increment semver version and commit the changes to main branch... | ||
increment: | ||
|
||
# Define the type of virtual host machine on which to run the job: | ||
runs-on: ubuntu-latest | ||
|
||
# Define the sequence of job steps... | ||
steps: | ||
|
||
# Checkout main branch of repository: | ||
- name: 'Checkout main branch' | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
|
||
# Increment version: | ||
- name: 'Increment version in `package.json` to the version number of the tag' | ||
run: | | ||
VERSION=$(echo ${{ github.ref }} | sed -E 's/refs\/tags\/v?([0-9]+.[0-9]+.[0-9]+).*/\1/') | ||
sed -Ei "s/\"version\": \"[^\"]+\"/\"version\": \"$VERSION\"/g" package.json | ||
# Configure git: | ||
- name: 'Configure git' | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "stdlib-bot" | ||
# Commit changes: | ||
- name: 'Commit changes' | ||
run: | | ||
git add package.json | ||
git commit -m "Auto-generated commit" | ||
# Push changes: | ||
- name: 'Push changes' | ||
run: | | ||
SLUG=${{ github.repository }} | ||
echo "Pushing changes to $SLUG..." | ||
git push "https://$GITHUB_ACTOR:[email protected]/$SLUG.git" main | ||
# Define job to cancel any running or queued workflow runs... | ||
cancel: | ||
|
||
|
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
Oops, something went wrong.