Skip to content

Commit

Permalink
fix: Add major and minor tags.
Browse files Browse the repository at this point in the history
Closes #25
  • Loading branch information
joberstein committed Aug 4, 2023
1 parent 09642d8 commit e94a1f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ The Github Workflow for this repo automatically commits up-to-date dist based on

The deploy script (./deploy.sh) will deploy to the 'release' breanch, which is orphaned so that it's history and contents is distinct from the 'master' branch, which contains all of the original source code.

Callers wishing to use this action should reference this repo by a versioned tag with the 'dist' suffix (i.e. joberstein/[email protected]). The source code is released under the standard version tag (vX.Y.Z), whereas the actual deploy artifacts are accessible with (vX.Y.Z-dist) for the same version. The source code does not contain 'node_modules', the 'dist' folder, or any other deploy artifacts.
Callers wishing to use this action should reference this repo by a versioned tag with the 'dist' suffix. (i.e. joberstein/[email protected]). This action can be referenced by any major, minor, or patch tag.

The source code is released under the standard version tag (vX.Y.Z), whereas the actual deploy artifacts are accessible with (vX.Y.Z-dist) for the same version. The source code does not contain 'node_modules', the 'dist' folder, or any other deploy artifacts.

# Scenarios

Expand Down
14 changes: 10 additions & 4 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
SOURCE_BRANCH=$(git branch --show-current)
TARGET_BRANCH="release"
VERSION=$1
NEW_TAG=v${VERSION}-dist
MAJOR=$(echo "$VERSION" | cut -d '.' -f 1)
MINOR=$(echo "$VERSION" | cut -d '.' -f 1-2)
TAGS=("$MAJOR" "$MINOR" "$VERSION")


if [ -z $VERSION ];
then
Expand Down Expand Up @@ -31,10 +34,13 @@ git add -vA
echo "Committing files..."
git commit -vm "Deploy $VERSION"

echo "Adding tag '${NEW_TAG}'"
git tag "$NEW_TAG"
for tagVersion in ${TAGS[@]}; do
TAG="v${tagVersion}-dist"
echo "Adding tag: '${TAG}'"
git tag --force "$TAG"
done

echo "Pushing commit..."
git push origin -u "${TARGET_BRANCH}" \
&& git push --tags \
&& git push --force --tags \
|| exit 1

0 comments on commit e94a1f8

Please sign in to comment.