Skip to content

Commit

Permalink
Target servers by name for mup actions (#11)
Browse files Browse the repository at this point in the history
* fix: force meteoer version 2.13.0 to prevent deployment failures on 2.13.1

* Add comments explaining the meteor issue

* Force version 2.12

* feat: Add option to pass a list of server names to target with mup commands

* feat: remove forced meteor version and use default meteor install url

* refactor: remove duuble quotes on vars in mup commands
  • Loading branch information
AlexanderOlivares committed Jan 25, 2024
1 parent 79a9842 commit 4b7ecd6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 23 deletions.
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
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

0 comments on commit 4b7ecd6

Please sign in to comment.