-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clean tags script & changeset commit
- Loading branch information
Showing
4 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": ["@changesets/changelog-github", { "repo": "@galacticcouncil/sdk" }], | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import getReleasePlan from '@changesets/get-release-plan'; | ||
import applyReleasePlan from '@changesets/apply-release-plan'; | ||
import { read } from '@changesets/config'; | ||
import * as git from '@changesets/git'; | ||
import { getPackages } from '@manypkg/get-packages'; | ||
import { exec } from 'child_process'; | ||
import outdent from 'outdent'; | ||
|
||
const cwd = process.cwd(); | ||
const packages = await getPackages(cwd); | ||
const config = await read(cwd, packages); | ||
|
||
const releasePlan = await getReleasePlan(cwd, undefined); | ||
const releases = releasePlan.releases.filter( | ||
(release) => release.type !== 'none' | ||
); | ||
const releasesLines = releases | ||
.map((release) => ` ${release.name}@${release.newVersion}`) | ||
.join('\n'); | ||
const releaseMessage = outdent` | ||
RELEASING: Releasing ${releases.length} package(s) | ||
Releases: | ||
${releasesLines} | ||
`; | ||
|
||
async function sh(cmd) { | ||
return new Promise(function (resolve, reject) { | ||
exec(cmd, (err, stdout, stderr) => { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve({ stdout, stderr }); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
await applyReleasePlan(releasePlan, packages, config, false); | ||
|
||
const { stdout } = await sh('npm i --package-lock-only'); | ||
console.log(stdout); | ||
|
||
await git.add('.', cwd); | ||
await git.commit(releaseMessage, cwd); | ||
console.log(releaseMessage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
TAGS=$(git tag --points-at HEAD) | ||
|
||
for tag in $TAGS; do | ||
if [[ $tag == *.0 ]]; then | ||
# Keep major & minor versions (publish) | ||
continue; | ||
else | ||
# Delete patch version | ||
git tag -d $tag | ||
fi | ||
done | ||
|
||
# Push tags | ||
git push --follow-tags |