Skip to content

Commit d2a8dc2

Browse files
authored
Merge pull request #133 from lufei/zip
Support generate zip when version exists
2 parents caf91de + 9039c78 commit d2a8dc2

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

deploy.sh

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,26 @@ svn update --set-depth infinity assets
6666
svn update --set-depth infinity trunk
6767
svn update --set-depth immediates tags
6868

69+
generate_zip() {
70+
if $INPUT_GENERATE_ZIP; then
71+
echo "Generating zip file..."
72+
73+
# use a symbolic link so the directory in the zip matches the slug
74+
ln -s "${SVN_DIR}/trunk" "${SVN_DIR}/${SLUG}"
75+
zip -r "${GITHUB_WORKSPACE}/${SLUG}.zip" "$SLUG"
76+
unlink "${SVN_DIR}/${SLUG}"
77+
78+
echo "zip-path=${GITHUB_WORKSPACE}/${SLUG}.zip" >> "${GITHUB_OUTPUT}"
79+
echo "✓ Zip file generated!"
80+
fi
81+
}
82+
6983
# Bail early if the plugin version is already published.
7084
if [[ -d "tags/$VERSION" ]]; then
7185
echo "ℹ︎ Version $VERSION of plugin $SLUG was already published";
86+
87+
generate_zip
88+
7289
exit
7390
fi
7491

@@ -173,16 +190,6 @@ else
173190
svn commit -m "Update to version $VERSION from GitHub" --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD"
174191
fi
175192

176-
if $INPUT_GENERATE_ZIP; then
177-
echo "Generating zip file..."
178-
179-
# use a symbolic link so the directory in the zip matches the slug
180-
ln -s "${SVN_DIR}/trunk" "${SVN_DIR}/${SLUG}"
181-
zip -r "${GITHUB_WORKSPACE}/${SLUG}.zip" "$SLUG"
182-
unlink "${SVN_DIR}/${SLUG}"
183-
184-
echo "zip-path=${GITHUB_WORKSPACE}/${SLUG}.zip" >> "${GITHUB_OUTPUT}"
185-
echo "✓ Zip file generated!"
186-
fi
193+
generate_zip
187194

188195
echo "✓ Plugin deployed!"

0 commit comments

Comments
 (0)