فهرست منبع

fix: refactor update-themes workflow

Sarah Norris 3 سال پیش
والد
کامیت
c0d740bddc
4فایلهای تغییر یافته به همراه9 افزوده شده و 8 حذف شده
  1. 4 4
      .github/workflows/update-themes.yml
  2. 2 1
      lerna.json
  3. 1 2
      package.json
  4. 2 1
      theme-utils.mjs

+ 4 - 4
.github/workflows/update-themes.yml

@@ -23,17 +23,17 @@ jobs:
         uses: actions/setup-node@v2
         with:
           node-version: 12
-      - name: Git Identity
+      - name: Set Git Identity
         run: |
           git config --global user.email 'github-actions[bot]@users.noreply.github.com'
           git config --global user.name 'github-actions[bot]'
-      - name: Update Themes
+      - name: Update Theme Versions & Changelogs
         run: |
           npm ci
           npm run update-versions
-          npm run update-stylecss
-      - name: Commit style.css Changes
+      - name: Update style.css Files
         run: |
+          npm run update-stylecss
           git add . 
           git commit -m "chore:"" auto-update style.css files"
           git push

+ 2 - 1
lerna.json

@@ -1,7 +1,8 @@
 {
   "command": {
     "version": {
-      "conventionalCommits": true
+      "conventionalCommits": true,
+      "message": "chore: update theme versions & changelogs"
     }
   },
   "packages": [

+ 1 - 2
package.json

@@ -27,8 +27,7 @@
 		"build:zip": "node ./theme-utils.mjs build-com-zip",
 		"commit": "npx cz",
 		"update-versions": "npx lerna version --conventional-commits --no-commit-hooks --no-push --yes",
-		"update-stylecss": "npx lerna exec --since -- node \\$LERNA_ROOT_PATH/theme-utils.mjs version-bump-stylecss",
-		"update-themes": "npm run update-versions && npm run update-stylecss"
+		"update-stylecss": "npx lerna exec --since -- node \\$LERNA_ROOT_PATH/theme-utils.mjs version-bump-stylecss"
 	},
 	"devDependencies": {
 		"@commitlint/cli": "^15.0.0",

+ 2 - 1
theme-utils.mjs

@@ -42,7 +42,8 @@ function showHelp(){
  Used by Lerna via update-stylecss command
 */
 async function versionBumpStyleCss() {
-	let newVersion = await executeCommand(`node -p "require('./package.json').version"`);
+	let packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
+	let newVersion = packageJson.version;
 	let styleCss = fs.existsSync('./style.css') ? './style.css' : '';
 	let styleChildThemeCss = fs.existsSync('./style-child-theme.css') ? './style-child-theme.css' : '';
 	let files = [styleCss, styleChildThemeCss].filter(Boolean);