Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target servers by name for mup actions #11

Merged
merged 8 commits into from Jan 25, 2024
38 changes: 21 additions & 17 deletions action.yml
@@ -1,21 +1,25 @@
name: "MUP Deploy"
description: "Deploy a Meteor application using Meteor Up"
inputs:
mode:
description: 'The MUP script to run. Either "DEPLOY", "SETUP", or "RESTART"'
required: true
meteor_deploy_path:
description: "The relative path to Meteor's .deploy directory"
required: true
package_manager:
description: 'The node package manager to use. Either "NPM" or "YARN"'
required: true
project_path:
description: "The path to the folder that contains the package.json for the Meteor app. Defaults to the current directory."
required: false
default: "."
mode:
description: 'The MUP script to run. Either "DEPLOY", "SETUP", or "RESTART"'
required: true
meteor_deploy_path:
description: "The relative path to Meteor's .deploy directory"
required: true
package_manager:
description: 'The node package manager to use. Either "NPM" or "YARN"'
required: true
project_path:
description: "The path to the folder that contains the package.json for the Meteor app. Defaults to the current directory."
required: false
default: "."
servers:
description: "Comma separated server names for the action to target. Ex: 'one,two'"
required: false
default: ""
runs:
using: "composite"
steps:
- run: chmod +x ${{github.action_path}}/script.sh && sh ${{github.action_path}}/script.sh ${{ inputs.mode }} ${{ inputs.meteor_deploy_path }} ${{ inputs.package_manager }} ${{ github.workspace }} ${{ inputs.project_path }}
shell: bash
using: "composite"
steps:
- run: chmod +x ${{github.action_path}}/script.sh && sh ${{github.action_path}}/script.sh ${{ inputs.mode }} ${{ inputs.meteor_deploy_path }} ${{ inputs.package_manager }} ${{ github.workspace }} ${{ inputs.project_path }}
shell: bash
19 changes: 13 additions & 6 deletions script.sh
Expand Up @@ -5,11 +5,14 @@
# Second parameter is the meteor deploy path
# Third parameter is the node package manager to use. Either "NPM" or "YARN"
# Fourth parameter is the absolute path of the repository
# fifth parameter is the folder that contains the package.json for the Meteor app. Defaults to the current directory.
# sixth parameter is a string of comma separated server names for the action to target. Ex: 'one,two'
mode=$1;
meteor_deploy_path=$2;
node_package_manager=$3
repository_path=$4
project_path=$5
servers=$6

echo "Running MUP GitHub action..."

Expand Down Expand Up @@ -37,14 +40,18 @@ if [ "${repository_path}" = "" ]; then
exit 1
fi

servers_option=""

if [ "${servers}" != "" ]; then
servers_option="--servers ${servers}"
fi

# Go to the root level
cd ~/

# Install meteor
echo "Installing Meteor..."
# Using version 2.12 temporarily due to this issue - https://github.com/meteor/meteor/issues/12771
# Need to change back to https://install.meteor.com/ when resolved to stay on the latest version
curl https://install.meteor.com\?release=2.12 | sh
curl https://install.meteor.com\ | sh
export METEOR_ALLOW_SUPERUSER=true

# Go to the project
Expand Down Expand Up @@ -72,11 +79,11 @@ cd $meteor_deploy_path
# Running specified command
if [ "${mode}" = "DEPLOY" ]; then
echo "Deploying using config from ${meteor_deploy_path}..."
mup deploy --verbose
mup deploy --verbose "$servers_option"
AlexanderOlivares marked this conversation as resolved.
Show resolved Hide resolved
elif [ "${mode}" = "SETUP" ]; then
echo "Setting up using config from ${meteor_deploy_path}..."
mup setup --verbose
mup setup --verbose "$servers_option"
elif [ "${mode}" = "RESTART" ]; then
echo "Restarting..."
mup restart
mup restart "$servers_option"
fi