Skip to content

Commit 6e2e9da

Browse files
authored
chore: fix template repo updater (#246)
1 parent 9ab8328 commit 6e2e9da

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,9 @@ jobs:
4444
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4545
NPM_CONFIG_PROVENANCE: true
4646
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
47+
48+
- name: Update Template Repo
49+
if: steps.changesets.outputs.published
50+
run: pnpm -F @sveltejs/create update-template-repo
51+
env:
4752
UPDATE_TEMPLATE_SSH_KEY: ${{ secrets.UPDATE_TEMPLATE_SSH_KEY }}

packages/cli/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
"scripts": {
1414
"check": "tsc",
1515
"format": "pnpm lint --write",
16-
"lint": "prettier --check . --config ../../prettier.config.js --ignore-path ../../.gitignore --ignore-path .gitignore --ignore-path ../../.prettierignore",
17-
"postpublish": "pnpm -F @sveltejs/create update-template-repo"
16+
"lint": "prettier --check . --config ../../prettier.config.js --ignore-path ../../.gitignore --ignore-path .gitignore --ignore-path ../../.prettierignore"
1817
},
1918
"files": [
2019
"dist"

packages/create/scripts/update-template-repo.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ get_abs_filename() {
77
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
88
}
99

10+
get_sv_version() {
11+
pnpm -F sv exec node -p "require('./package.json').version"
12+
}
13+
14+
VERSION=$(get_sv_version)
1015
DIR=$(get_abs_filename $(dirname "$0"))
1116
TMP=$(get_abs_filename "$DIR/../node_modules/.tmp")
1217

@@ -31,8 +36,9 @@ if [ "$CI" ]; then
3136
git config user.name '[bot]'
3237
fi
3338

34-
# commit the new files
35-
git add -A
36-
git commit -m "version $npm_package_version"
37-
38-
git push [email protected]:sveltejs/kit-template-default.git main -f
39+
# commit when there are new files
40+
if [[ `git status --porcelain` ]]; then
41+
git add -A
42+
git commit -m "version $VERSION"
43+
git push [email protected]:sveltejs/kit-template-default.git main -f
44+
fi

0 commit comments

Comments
 (0)