Skip to content

Commit

Permalink
Merge pull request #26 from joberstein/#25
Browse files Browse the repository at this point in the history
#25: Add major and minor tags
  • Loading branch information
joberstein authored Aug 4, 2023
2 parents 2ceb65b + e94a1f8 commit 083ebb1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
extra_plugins: |
@semantic-release/exec
@semantic-release/exec
semantic-release-major-tag
8 changes: 8 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
{
"publishCmd": "./deploy.sh ${nextRelease.version}"
}
],
[
"semantic-release-major-tag", {
"customTags": [
"v${major}",
"v${major}.${minor}"
]
}
]
]
}
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 083ebb1

Please sign in to comment.