Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
glitch452 committed Apr 16, 2024
1 parent 4ecad57 commit 491625f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 29 deletions.
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-slim
FROM node:18-slim

LABEL version="1.0.0"
LABEL repository="http://github.com/Github-Actions-Community/merge-release"
Expand All @@ -12,14 +12,12 @@ LABEL com.github.actions.color="red"

RUN apt-get -y update && \
apt-get -y --no-install-recommends install git jq findutils curl ca-certificates && \
rm -rf /var/lib/apt/lists/* && \
npm update -g npm
rm -rf /var/lib/apt/lists/*

WORKDIR /usr/app
COPY ./ ./
COPY . .

# Install dependencies here
RUN npm ci --omit dev

ENTRYPOINT ["/usr/app/entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]
CMD ["help"]
44 changes: 22 additions & 22 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
set -e

# Map the inputs over to the environment variables to support both `env` and `with` methods for backwards-compatibility
export DEBUG=${INPUT_DEBUG:-"$DEBUG"}
export DEPLOY_DIR=${INPUT_DEPLOY_DIR:-"$DEPLOY_DIR"}
export DISABLE_GIT_TAG=${INPUT_DISABLE_GIT_TAG:-"$DISABLE_GIT_TAG"}
export GIT_TAG_SUFFIX=${INPUT_GIT_TAG_SUFFIX:-"$GIT_TAG_SUFFIX"}
export GITHUB_ACTOR=${INPUT_GITHUB_ACTOR:-"$GITHUB_ACTOR"}
export GITHUB_REPOSITORY=${INPUT_GITHUB_REPOSITORY:-"$GITHUB_REPOSITORY"}
export GITHUB_TOKEN=${INPUT_GITHUB_TOKEN:-"$GITHUB_TOKEN"}
export MAJOR_TAGS=${INPUT_MAJOR_TAGS:-"$MAJOR_TAGS"}
export MINOR_TAGS=${INPUT_MINOR_TAGS:-"$MINOR_TAGS"}
export NPM_AUTH_TOKEN=${INPUT_NPM_AUTH_TOKEN:-"$NPM_AUTH_TOKEN"}
export NPM_CONFIG_USERCONFIG=${INPUT_NPM_CONFIG_USERCONFIG:-"$NPM_CONFIG_USERCONFIG"}
export NPM_CUSTOM_NPMRC=${INPUT_NPM_CUSTOM_NPMRC:-"$NPM_CUSTOM_NPMRC"}
export NPM_PRIVATE=${INPUT_NPM_PRIVATE:-"$NPM_PRIVATE"}
export NPM_REGISTRY_URL=${INPUT_NPM_REGISTRY_URL:-"$NPM_REGISTRY_URL"}
export SRC_PACKAGE_DIR=${INPUT_SRC_PACKAGE_DIR:-"$SRC_PACKAGE_DIR"}
export DEBUG="${INPUT_DEBUG:-"$DEBUG"}"
export DEPLOY_DIR="${INPUT_DEPLOY_DIR:-"$DEPLOY_DIR"}"
export DISABLE_GIT_TAG="${INPUT_DISABLE_GIT_TAG:-"$DISABLE_GIT_TAG"}"
export GIT_TAG_SUFFIX="${INPUT_GIT_TAG_SUFFIX:-"$GIT_TAG_SUFFIX"}"
export GITHUB_ACTOR="${INPUT_GITHUB_ACTOR:-"$GITHUB_ACTOR"}"
export GITHUB_REPOSITORY="${INPUT_GITHUB_REPOSITORY:-"$GITHUB_REPOSITORY"}"
export GITHUB_TOKEN="${INPUT_GITHUB_TOKEN:-"$GITHUB_TOKEN"}"
export MAJOR_TAGS="${INPUT_MAJOR_TAGS:-"$MAJOR_TAGS"}"
export MINOR_TAGS="${INPUT_MINOR_TAGS:-"$MINOR_TAGS"}"
export NPM_AUTH_TOKEN="${INPUT_NPM_AUTH_TOKEN:-"$NPM_AUTH_TOKEN"}"
export NPM_CONFIG_USERCONFIG="${INPUT_NPM_CONFIG_USERCONFIG:-"$NPM_CONFIG_USERCONFIG"}"
export NPM_CUSTOM_NPMRC="${INPUT_NPM_CUSTOM_NPMRC:-"$NPM_CUSTOM_NPMRC"}"
export NPM_PRIVATE="${INPUT_NPM_PRIVATE:-"$NPM_PRIVATE"}"
export NPM_REGISTRY_URL="${INPUT_NPM_REGISTRY_URL:-"$NPM_REGISTRY_URL"}"
export SRC_PACKAGE_DIR="${INPUT_SRC_PACKAGE_DIR:-"$SRC_PACKAGE_DIR"}"

# Set default values
NPM_STRICT_SSL="${NPM_STRICT_SSL-true}"
Expand All @@ -26,10 +26,10 @@ if ! $NPM_STRICT_SSL; then
NPM_REGISTRY_SCHEME="http"
fi
NPM_REGISTRY_URL="${NPM_REGISTRY_SCHEME}://"$(echo "${NPM_REGISTRY_URL:-registry.npmjs.org}" | sed -r 's/https?:\/\///')
MINOR_TAGS=${MINOR_TAGS:-"feat"}
DEPLOY_DIR=${DEPLOY_DIR:-"."}
SRC_PACKAGE_DIR=${SRC_PACKAGE_DIR:-"."}
NPM_CONFIG_USERCONFIG=${NPM_CONFIG_USERCONFIG:-"$HOME/.npmrc"}
MINOR_TAGS="${MINOR_TAGS:-"feat"}"
DEPLOY_DIR="${DEPLOY_DIR:-"."}"
SRC_PACKAGE_DIR="${SRC_PACKAGE_DIR:-"."}"
NPM_CONFIG_USERCONFIG="${NPM_CONFIG_USERCONFIG:-"$HOME/.npmrc"}"

if [ "$DEBUG" = "true" ]; then
echo "Debug Enabled, Printing Environment:"
Expand All @@ -40,13 +40,13 @@ fi
if [ -n "$NPM_CUSTOM_NPMRC" ]; then
# Use a fully-formed npmrc file if provided
echo "$NPM_CUSTOM_NPMRC" > "$NPM_CONFIG_USERCONFIG"
chmod 0600 "$NPM_CONFIG_USERCONFIG"
elif [ -n "$NPM_AUTH_TOKEN" ]; then
# Allow registry.npmjs.org to be overridden with an environment variable
printf "//%s/:_authToken=%s\\nregistry=%s\\nstrict-ssl=%s" "$NPM_REGISTRY_URL" "$NPM_AUTH_TOKEN" "$NPM_REGISTRY_URL" "${NPM_STRICT_SSL}" > "$NPM_CONFIG_USERCONFIG"
chmod 0600 "$NPM_CONFIG_USERCONFIG"
fi

chmod 0600 "$NPM_CONFIG_USERCONFIG"

if [ "$DEBUG" = "true" ]; then
echo "Debug Enabled, Printing '$NPM_CONFIG_USERCONFIG' file contents:"
cat "$NPM_CONFIG_USERCONFIG"
Expand All @@ -65,4 +65,4 @@ git show-ref # useful for debugging
git branch --verbose

# Dependencies are installed at build time
node /usr/app/src/merge-release-run.js "$@" || exit 1
node /src/merge-release-run.js "$@" || exit 1
2 changes: 1 addition & 1 deletion src/merge-release-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const run = async () => {

console.log(' New Version:', newVersion);

if (pkg.scripts && pkg.scripts.publish) {
if (pkg?.scripts?.publish) {
spawnSync(`npm run publish`, deployDir);
} else {
const verbose = debug ? ' --verbose' : '';
Expand Down

0 comments on commit 491625f

Please sign in to comment.