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 Apr 15, 2022
1 parent 3b99e76 commit b33e479
Show file tree
Hide file tree
Showing 68 changed files with 46,834 additions and 262 deletions.
193 changes: 151 additions & 42 deletions .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,20 @@ name: bundle
# Workflow triggers:
on:
workflow_dispatch:
push:
branches:
- main
tags-ignore:
- 'v[0-9]+\.[0-9]+\.[0-9]+'
workflow_run:
workflows: ["productionize"]
types: [completed]

# Workflow jobs:
jobs:
deno:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout production branch
run: |
git fetch --all
git checkout -b production origin/production
- name: Copy files to deno directory
run: |
mkdir -p deno
Expand Down Expand Up @@ -85,18 +87,51 @@ jobs:
# Create package.json file for deno branch:
jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json
- name: Publish to deno branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./deno
publish_branch: deno
force_orphan: true
user_name: 'stdlib-bot'
user_email: '[email protected]'
commit_message: 'Auto-generated commit'
enable_jekyll: true
- name: Configure git
run: |
git config --local user.email "[email protected]"
git config --local user.name "stdlib-bot"
- name: Check if remote `deno` branch exists
id: deno-branch-exists
continue-on-error: true
run: |
git ls-remote --exit-code --heads origin deno
if [ $? -eq 0 ]; then
echo "::set-output name=remote-exists::true"
else
echo "::set-output name=remote-exists::false"
fi
- name: If `deno` exists, checkout branch and rebase on `main`
if: steps.deno-branch-exists.outputs.remote-exists
continue-on-error: true
run: |
git checkout -b deno origin/deno
git rebase main -s recursive -X ours
while [ $? -ne 0 ]; do
git rebase --skip
done
- name: If `deno` does not exist, checkout `main` and create `deno` branch
if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }}
run: |
git checkout main
git checkout -b deno
- 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
- name: Move deno directory to root
run: |
mv ./deno/* .
rmdir ./deno
- name: Commit changes
run: |
git add -A
git commit -m "Auto-generated commit"
- name: Push changes
run: |
SLUG=${{ github.repository }}
echo "Pushing changes to $SLUG..."
git push "https://$GITHUB_ACTOR:[email protected]/$SLUG.git" deno --force
- name: Send status to Slack channel in case of failure
uses: act10ns/slack@v1
with:
Expand All @@ -108,6 +143,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout production branch
run: |
git fetch --all
git checkout -b production origin/production
- name: Copy files to umd directory
run: |
mkdir -p umd
Expand All @@ -121,7 +160,7 @@ jobs:
run: |
npm install || npm install || npm install
timeout-minutes: 15
- name: Extract Alias
- name: Extract alias
id: extract-alias
run: |
alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/')
Expand Down Expand Up @@ -157,18 +196,51 @@ jobs:
# Create package.json file for umd branch:
jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "main": "./bundle.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./umd/package.json
- name: Publish to umd branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./umd
publish_branch: umd
force_orphan: true
user_name: 'stdlib-bot'
user_email: '[email protected]'
commit_message: 'Auto-generated commit'
enable_jekyll: true
- name: Configure git
run: |
git config --local user.email "[email protected]"
git config --local user.name "stdlib-bot"
- name: Check if remote `umd` branch exists
id: umd-branch-exists
continue-on-error: true
run: |
git ls-remote --exit-code --heads origin umd
if [ $? -eq 0 ]; then
echo "::set-output name=remote-exists::true"
else
echo "::set-output name=remote-exists::false"
fi
- name: If `umd` exists, checkout branch and rebase on `main`
if: steps.umd-branch-exists.outputs.remote-exists
continue-on-error: true
run: |
git checkout -b umd origin/umd
git rebase main -s recursive -X ours
while [ $? -ne 0 ]; do
git rebase --skip
done
- name: If `umd` does not exist, checkout `main` and create `umd` branch
if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }}
run: |
git checkout main
git checkout -b umd
- 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
- name: Move umd directory to root
run: |
mv ./umd/* .
rmdir ./umd
- name: Commit changes
run: |
git add -A
git commit -m "Auto-generated commit"
- name: Push changes
run: |
SLUG=${{ github.repository }}
echo "Pushing changes to $SLUG..."
git push "https://$GITHUB_ACTOR:[email protected]/$SLUG.git" umd --force
- name: Send status to Slack channel in case of failure
uses: act10ns/slack@v1
with:
Expand All @@ -180,6 +252,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout production branch
run: |
git fetch --all
git checkout -b production origin/production
- name: Copy files to umd directory
run: |
mkdir -p esm
Expand Down Expand Up @@ -235,18 +311,51 @@ jobs:
# Create package.json file for esm branch:
jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./index.mjs", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./esm/package.json
- name: Publish to esm branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./esm
publish_branch: esm
force_orphan: true
user_name: 'stdlib-bot'
user_email: '[email protected]'
commit_message: 'Auto-generated commit'
enable_jekyll: true
- name: Configure git
run: |
git config --local user.email "[email protected]"
git config --local user.name "stdlib-bot"
- name: Check if remote `esm` branch exists
id: esm-branch-exists
continue-on-error: true
run: |
git ls-remote --exit-code --heads origin esm
if [ $? -eq 0 ]; then
echo "::set-output name=remote-exists::true"
else
echo "::set-output name=remote-exists::false"
fi
- name: If `esm` exists, checkout branch and rebase on `main`
if: steps.esm-branch-exists.outputs.remote-exists
continue-on-error: true
run: |
git checkout -b esm origin/esm
git rebase main -s recursive -X ours
while [ $? -ne 0 ]; do
git rebase --skip
done
- name: If `esm` does not exist, checkout `main` and create `esm` branch
if: ${{ steps.esm-branch-exists.outputs.remote-exists == false }}
run: |
git checkout main
git checkout -b esm
- 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
- name: Move esm directory to root
run: |
mv ./esm/* .
rmdir ./esm
- name: Commit changes
run: |
git add -A
git commit -m "Auto-generated commit"
- name: Push changes
run: |
SLUG=${{ github.repository }}
echo "Pushing changes to $SLUG..."
git push "https://$GITHUB_ACTOR:[email protected]/$SLUG.git" esm --force
- name: Send status to Slack channel in case of failure
uses: act10ns/slack@v1
with:
Expand Down
94 changes: 94 additions & 0 deletions .github/workflows/productionize.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#/
# @license Apache-2.0
#
# Copyright (c) 2022 The Stdlib Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#/

# Workflow name:
name: productionize

# Workflow triggers:
on:
push:
workflow_dispatch:

# Workflow jobs:
jobs:
productionize:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v3
with:
ref: main
- name: Create new `production` branch
run: |
git checkout -b production
- name: Transform Error Messages
id: transform-error-messages
uses: stdlib-js/transform-errors-action@main
- name: Replace double quotes with single quotes in rewritten format string error messages
run: |
find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \;
- name: Replace double quotes with single quotes in rewritten string literal error messages
run: |
find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \;
- name: Replace double quotes with single quotes in inserted `require` calls
run: |
find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \;
- name: Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency
run: |
if grep -q '"@stdlib/string-format"' package.json; then
sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json
else
sed -i "s/\"dependencies\": {/\"dependencies\": {\\n \"@stdlib\/error-tools-fmtprodmsg\": \"^0.0.x\",/g" package.json
fi
- name: Configure git
run: |
git config --local user.email "[email protected]"
git config --local user.name "stdlib-bot"
- name: Commit changes
run: |
git add -A
git commit -m "Transform error messages"
- name: Push changes
run: |
SLUG=${{ github.repository }}
echo "Pushing changes to $SLUG..."
git push "https://$GITHUB_ACTOR:[email protected]/$SLUG.git" production --force
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: production
- uses: actions/setup-node@v2
with:
node-version: 16
timeout-minutes: 5
- name: Install production and development dependencies
id: install
run: |
npm install || npm install || npm install
timeout-minutes: 15
- name: Build native add-on (if present)
run: |
if [ -f "binding.gyp" ]; then
npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild
fi
- name: Run tests
id: tests
run: |
npm test || npm test || npm test
2 changes: 1 addition & 1 deletion .github/workflows/test_bundles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ name: test_bundles
# Workflow triggers:
on:
workflow_run:
workflows: ["test"]
workflows: ["bundle"]
types: [completed]
workflow_dispatch:

Expand Down
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ CONTRIBUTING.md
CONTRIBUTORS
TODO.md
ROADMAP.md
branches.md
.postinstall.json
Makefile

Expand Down
Loading

0 comments on commit b33e479

Please sign in to comment.