Skip to content

Commit ecaaf88

Browse files
committed
feat: update tag management script
1 parent 78e64a2 commit ecaaf88

File tree

5 files changed

+73
-26
lines changed

5 files changed

+73
-26
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/.github export-ignore
22
/*.md export-ignore
33
/update.nu export-ignore
4+
/update.js export-ignore
45
/.gitattributes export-ignore

.github/workflows/update.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ jobs:
1212
uses: actions/checkout@v4
1313
with:
1414
fetch-depth: 0
15-
- name: Setup Nushell
16-
uses: hustcer/setup-nu@v3.8
1715
- name: Create missing tags
1816
run: |
1917
git config --global user.name "$GITHUB_ACTOR"
2018
git config --global user.email "<>"
21-
nu update.nu
19+
node update.js
2220
- name: Push tags
2321
run: |
2422
git push --tags

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
# Shopware 6 production template
1+
# Shopware 6 project template
22

3-
This repository contains the production template that enables you to build,
4-
package and deploy Shopware 6 to production shops.
3+
This repository contains the project template that enables you to start a new project.
54

65
## Installation and usage instructions
76

7+
You can use `composer create-project shopware/production <project-name>` to create a new Shopware project.
8+
9+
If you want to use a specific version of Shopware, you can specify the version in the command like this:
10+
11+
```bash
12+
composer create-project shopware/production:6.6.0.0 <project-name>
13+
```
14+
815
Please refer to the
916
[documentation](https://developer.shopware.com/docs/guides/installation/template)
1017
for instructions on how to use this template.

update.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env node
2+
3+
import fs from 'fs';
4+
import { execSync } from 'child_process';
5+
6+
/**
7+
* Update Shopware core to latest version
8+
*
9+
* This script:
10+
* 1. Fetches all tags from Shopware core repository
11+
* 2. For each tag, checks if it already exists in the local git repository
12+
* 3. If not, updates composer.json, commits changes, tags, and resets to trunk
13+
*/
14+
async function update() {
15+
try {
16+
// Fetch tags from GitHub
17+
const response = await fetch('https://api.github.com/repos/shopware/core/tags');
18+
const tags = await response.json();
19+
20+
// Process each tag
21+
for (const item of tags) {
22+
try {
23+
// Check if tag already exists in the repo
24+
execSync(`git rev-parse ${item.name}`, { stdio: 'pipe' });
25+
console.log(`Tag ${item.name} already exists, skipping...`);
26+
} catch (error) {
27+
// Tag doesn't exist, proceed with update
28+
console.log(`Processing new tag: ${item.name}`);
29+
30+
// Read composer.json
31+
const composerJsonPath = './composer.json';
32+
let composerJson = JSON.parse(fs.readFileSync(composerJsonPath, 'utf8'));
33+
34+
// Update stability setting
35+
if (item.name.includes('rc')) {
36+
composerJson['minimum-stability'] = 'RC';
37+
} else {
38+
composerJson['minimum-stability'] = 'stable';
39+
}
40+
41+
// Update shopware/core version
42+
composerJson.require['shopware/core'] = item.name;
43+
44+
// Write updated composer.json
45+
fs.writeFileSync(composerJsonPath, JSON.stringify(composerJson, null, 2));
46+
47+
// Git operations
48+
execSync('git add composer.json');
49+
execSync(`git commit -m "Update shopware/core to ${item.name}"`, {stdio: 'inherit'});
50+
execSync(`git tag -m "Release: ${item.name}" ${item.name}`, {stdio: 'inherit'});
51+
execSync('git reset --hard origin/trunk', {stdio: 'inherit'});
52+
53+
console.log(`Successfully processed tag: ${item.name}`);
54+
}
55+
}
56+
} catch (error) {
57+
console.error('An error occurred:', error);
58+
}
59+
}
60+
61+
await update();

update.nu

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)