#/
# @license Apache-2.0
#
# Copyright (c) 2021 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: standalone_push_changes

# Workflow triggers:
on:
  push:

# Workflow jobs:
jobs:

  # Define a job for publishing standalone packages...
  publish:

    # Define a display name:
    name: "Push Changes to Standalone Packages"

    # Define the type of virtual host machine:
    runs-on: ubuntu-latest

    # Define the sequence of job steps...
    steps:

      # Checkout the repository:
      - name: 'Checkout repository'
        uses: actions/checkout@v2
        with:
          # Specify whether to remove untracked files before checking out the repository:
          clean: false

          # Retrieve all commits from the branch:
          fetch-depth: 0

          # Specify whether to download Git-LFS files:
          lfs: false
        timeout-minutes: 10

      # Install Node.js:
      - name: 'Install Node.js'
        uses: actions/setup-node@v2
        with:
          node-version: 15
        timeout-minutes: 5

      # Install dependencies:
      - name: 'Install dependencies'
        run: |
          npm install
        timeout-minutes: 15

      # Retrieve list of changed stdlib packages in a push or pull request:
      - name: 'Retrieve list of changed stdlib packages'
        id: 'changed-packages'
        uses: stdlib-js/changed-packages-action@v1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      # Push changes to the packages' repositories:
      - name: 'Push changes to packages'
        env:
          GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
        run: |
          echo "Pushing changes to the following repositories: ${{ steps.changed-packages.outputs.packages }}"
          node lib/node_modules/@stdlib/_tools/scripts/publish_packages.js ${{ join( fromJSON( steps.changed-packages.outputs.packages ), ' ' ) }}

Add workflow to push changes to standalone repos
Add workflow to push changes to standalone repos
