-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
408c799
commit 3d699f7
Showing
23 changed files
with
432 additions
and
370 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 |
---|---|---|
|
@@ -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 | ||
|
@@ -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: | ||
|
@@ -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 | ||
|
@@ -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/') | ||
|
@@ -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: | ||
|
@@ -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 | ||
|
@@ -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: | ||
|
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 |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
#/ | ||
|
||
# Workflow name: | ||
name: Close Pull Requests | ||
name: close_pull_requests | ||
|
||
# Workflow triggers: | ||
on: | ||
|
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,98 @@ | ||
#/ | ||
# @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: npm_downloads | ||
|
||
# Workflow triggers: | ||
on: | ||
# Run this workflow weekly: | ||
schedule: | ||
# cron: '<minutes> <hours> <day_of_month> <month> <day_of_week>' | ||
- cron: '0 8 * * 6' | ||
|
||
# Allow the workflow to be manually run: | ||
workflow_dispatch: | ||
|
||
# Workflow jobs: | ||
jobs: | ||
|
||
# Define a job for retrieving npm download counts... | ||
npm_downloads: | ||
|
||
# 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 the repository: | ||
- name: 'Checkout repository' | ||
uses: actions/checkout@v3 | ||
timeout-minutes: 10 | ||
|
||
# Install Node.js: | ||
- name: 'Install Node.js' | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
timeout-minutes: 5 | ||
|
||
# Resolve package name: | ||
- name: 'Resolve package name' | ||
id: package_name | ||
run: | | ||
name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` | ||
echo "::set-output name=package_name::$name" | ||
timeout-minutes: 5 | ||
|
||
# Fetch download data: | ||
- name: 'Fetch data' | ||
id: download_data | ||
run: | | ||
url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" | ||
echo "$url" | ||
data=$(curl "$url") | ||
mkdir ./tmp | ||
echo "$data" > ./tmp/npm_downloads.json | ||
echo "::set-output name=data::$data" | ||
timeout-minutes: 5 | ||
|
||
# Upload the download data: | ||
- name: 'Upload data' | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
# Define a name for the uploaded artifact (ensuring a unique name for each job): | ||
name: npm_downloads | ||
|
||
# Specify the path to the file to upload: | ||
path: ./tmp/npm_downloads.json | ||
|
||
# Specify the number of days to retain the artifact (default is 90 days): | ||
retention-days: 90 | ||
timeout-minutes: 10 | ||
if: success() | ||
|
||
# Send data to events server: | ||
- name: 'Post data' | ||
uses: distributhor/workflow-webhook@v2 | ||
env: | ||
webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} | ||
webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} | ||
data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' | ||
timeout-minutes: 5 | ||
if: success() |
Oops, something went wrong.