-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·34 lines (31 loc) · 1022 Bytes
/
release.sh
File metadata and controls
executable file
·34 lines (31 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
git fetch --tags
bump="${1:-patch}"
newtag="$(git semver "${bump}" --dryrun)"
yarntag="$(jq -r '.version' package.json)"
if [[ ${yarntag} != "${newtag#v}" ]]; then
yarn version -i "${newtag}" || true
yarn build
fi
git add package.json yarn.lock .yarn
git commit -m "chore(release): bump version to ${newtag}" --no-verify
git semver "${bump}"
# newtag2="$(git semver get)"
# if [[ "${newtag}" != "${newtag2}" ]]; then
# echo "ERROR: new tag does not match expected tag"
# echo " expected: ${newtag}"
# echo " actual: ${newtag2}"
# exit 1
# fi
stub_major="${newtag%%\.*}"
stub_major_minor="${newtag%\.*}"
git tag -d "${stub_major}" 2>/dev/null || true
git tag -d "${stub_major_minor}" 2>/dev/null || true
git tag -a "${stub_major}" -m "Release ${newtag}"
git tag -a "${stub_major_minor}" -m "Release ${newtag}"
git push origin ":${stub_major}" 2>/dev/null || true
git push origin ":${stub_major_minor}" 2>/dev/null || true
yarn postversion
git push
git push --tags
# yarn release:post