-
Notifications
You must be signed in to change notification settings - Fork 8
59 lines (50 loc) · 2.21 KB
/
update-template-versions.yml
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Update Template Versions
on:
workflow_dispatch:
inputs:
version:
description: 'New version (e.g., 2024.10)'
required: true
directories:
description: 'Directories to update (comma-separated)'
required: true
jobs:
update-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Update versions
run: |
VERSION="${{ github.event.inputs.version }}"
DIRECTORIES="${{ github.event.inputs.directories }}"
# Convert version format for api_version
API_VERSION=$(echo $VERSION | sed 's/\./-/')
for dir in $(echo $DIRECTORIES | tr ',' ' '); do
if [ -d "$dir" ]; then
# Update package.json/liquid
if [ -f "$dir/package.json.liquid" ]; then
sed -i 's/"@shopify\/ui-extensions": "[^"]*"/"@shopify\/ui-extensions": "'$VERSION'.x"/' "$dir/package.json.liquid"
sed -i 's/"@shopify\/ui-extensions-react": "[^"]*"/"@shopify\/ui-extensions-react": "'$VERSION'.x"/' "$dir/package.json.liquid"
fi
# Update shopify.extension.toml.liquid
if [ -f "$dir/shopify.extension.toml.liquid" ]; then
sed -i 's/api_version = "[^"]*"/api_version = "'$API_VERSION'"/' "$dir/shopify.extension.toml.liquid"
fi
else
echo "Directory $dir not found, skipping..."
fi
done
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: Update template versions to ${{ github.event.inputs.version }}
title: Update template versions to ${{ github.event.inputs.version }}
body: |
This PR updates the versions of @shopify/ui-extensions and @shopify/ui-extensions-react in package.json/liquid files,
and api_version in shopify.extension.toml.liquid files to ${{ github.event.inputs.version }}.
Updated directories: ${{ github.event.inputs.directories }}
branch: update-template-versions-${{ github.event.inputs.version }}