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 Jul 9, 2022
1 parent b675912 commit affdc8f
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 42 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/bundle_tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@

#/
# @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: bundle_tags

# Workflow triggers:
on:
# Run workflow when a new tag is pushed to the repository:
push:
tags:
- '*'

# Workflow jobs:
jobs:

# Define job to wait a minute before running the workflow...
waiting:

# Define display name:
name: 'Waiting Period'

# Define the type of virtual host machine on which to run the job:
runs-on: ubuntu-latest

# Define the steps to run:
steps:

# Wait a minute:
- name: 'Wait a minute'
run: |
sleep 60s
# Define job to publish bundle tags to GitHub...
create-tags:

# Define display name:
name: 'Create bundle tags'

# 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: waiting

# Define the steps to run:
steps:

# Wait for the productionize workflow to succeed:
- name: 'Wait for productionize workflow to succeed'
uses: lewagon/wait-on-check-action@v1.0.0
with:
ref: main
check-name: 'Productionize status'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 60
allowed-conclusions: success

# Checkout the repository:
- name: 'Checkout repository'
uses: actions/checkout@v3

# Configure git:
- name: 'Configure git'
run: |
git config --local user.email "noreply@stdlib.io"
git config --local user.name "stdlib-bot"
git fetch --all
# Create bundle tags:
- name: 'Create bundle tags'
run: |
SLUG=${{ github.repository }}
VERSION=$(echo ${{ github.ref }} | sed -E -n 's/refs\/tags\/?(v[0-9]+.[0-9]+.[0-9]+).*/\1/p')
git checkout -b deno origin/deno
git tag -a $VERSION-deno -m "$VERSION-deno"
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-deno
git checkout -b umd origin/umd
git tag -a $VERSION-umd -m "$VERSION-umd"
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-umd
git checkout -b esm origin/esm
git tag -a $VERSION-esm -m "$VERSION-esm"
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-esm
84 changes: 44 additions & 40 deletions .github/workflows/productionize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ 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:
Expand Down Expand Up @@ -309,21 +311,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:$GITHUB_TOKEN@github.com/$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:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-deno
fi
echo "Pushing changes to $SLUG..."
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno
# Send status to Slack channel if job fails:
- name: 'Send status to Slack channel in case of failure'
Expand Down Expand Up @@ -482,21 +475,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:$GITHUB_TOKEN@github.com/$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:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-umd
fi
echo "Pushing changes to $SLUG..."
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" umd
# Send status to Slack channel if job fails:
- name: 'Send status to Slack channel in case of failure'
Expand Down Expand Up @@ -661,21 +645,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:$GITHUB_TOKEN@github.com/$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:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-esm
fi
echo "Pushing changes to $SLUG..."
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$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 +660,32 @@ jobs:
steps: ${{ toJson(steps) }}
channel: '#npm-ci'
if: failure()

# Define job that succeeds if all bundles were successfully built:
productionize-status

# Define display name:
name: 'Productionize status'

# 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 jobs finishing:
needs: [ bundle-deno, bundle-umd, bundle-esm ]

# Define the steps to be executed:
steps:

- name: 'If all bundles were successfully generated...'
if: always() && (needs.bundle-deno.result == 'success' && needs.bundle-umd.result == 'success' && needs.bundle-esm.result == 'success')
run: |
echo "All bundles were successfully built."
echo "Success!"
exit 0
- name: 'If any bundle failed to be generated...'
if: always() && (needs.bundle-deno.result == 'failure' || needs.bundle-umd.result == 'failure' || needs.bundle-esm.result == 'failure')
run: |
echo "One or more bundles failed to be generated."
echo "Failure!"
exit 1
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
[npm-image]: http://img.shields.io/npm/v/@stdlib/stats-base-meanwd.svg
[npm-url]: https://npmjs.org/package/@stdlib/stats-base-meanwd

[test-image]: https://github.com/stdlib-js/stats-base-meanwd/actions/workflows/test.yml/badge.svg?branch=v0.0.8
[test-url]: https://github.com/stdlib-js/stats-base-meanwd/actions/workflows/test.yml?query=branch:v0.0.8
[test-image]: https://github.com/stdlib-js/stats-base-meanwd/actions/workflows/test.yml/badge.svg?branch=main
[test-url]: https://github.com/stdlib-js/stats-base-meanwd/actions/workflows/test.yml?query=branch:main

[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-base-meanwd/main.svg
[coverage-url]: https://codecov.io/github/stdlib-js/stats-base-meanwd?branch=main
Expand Down
2 changes: 2 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@ var meanwd = require( './main.js' );
// EXPORTS //

module.exports = meanwd;

// exports: { "ndarray": "meanwd.ndarray" }

0 comments on commit affdc8f

Please sign in to comment.