@@ -3,6 +3,9 @@ name: Sync examples
3
3
on :
4
4
workflow_dispatch :
5
5
inputs :
6
+ checkout-ref :
7
+ type : string
8
+ required : false
6
9
skip-unchanged-check :
7
10
type : boolean
8
11
default : false
@@ -31,16 +34,25 @@ jobs:
31
34
uses : actions/checkout@v4
32
35
with :
33
36
fetch-depth : 2 # fetch 2 to compare with previous commit for changes
37
+ ref : ${{ inputs.checkout-ref }}
34
38
35
39
- name : Detect changesets
36
40
uses : bluwy/detect-changesets-action@v1
37
41
id : detect
38
42
43
+ - name : Get pre mode of changesets
44
+ id : pre
45
+ run : |
46
+ if [ -f ./.changeset/pre.json ]; then
47
+ pre_value=$(jq -r '.tag' ./.changeset/pre.json)
48
+ echo "value=$pre_value" >> $GITHUB_OUTPUT
49
+ fi
50
+
39
51
# We only do sync if there are no changesets, so we don't accidentally allow users
40
52
# to clone examples that may rely on unreleased code
41
53
42
- - name : Sync from main branch to latest and examples/* branches
43
- if : steps.detect.outputs.has-changesets == 'false' && github.ref == 'refs/heads/main'
54
+ - name : Sync stable to latest and examples/* branches
55
+ if : steps.detect.outputs.has-changesets == 'false' && github.ref == 'refs/heads/main' && steps.pre.outputs.value == ''
44
56
uses : bluwy/auto-branch-sync-action@v1
45
57
with :
46
58
map : |
@@ -49,38 +61,24 @@ jobs:
49
61
skip-unchanged-check : ${{ inputs.skip-unchanged-check == true }}
50
62
dry-run : ${{ inputs.dry-run == true }}
51
63
52
- - name : Check .changeset/pre.json for matching tag
53
- if : steps.detect.outputs.has-changesets == 'false' && github.ref == 'refs/heads/next'
54
- id : check-pre-mode
55
- run : |
56
- if [ -f ./.changeset/pre.json ]; then
57
- if grep -q '"tag": "alpha"' ./.changeset/pre.json; then
58
- echo "alpha=true" >> $GITHUB_OUTPUT
59
- elif grep -q '"tag": "beta"' ./.changeset/pre.json; then
60
- echo "beta=true" >> $GITHUB_OUTPUT
61
- elif grep -q '"tag": "rc"' ./.changeset/pre.json; then
62
- echo "rc=true" >> $GITHUB_OUTPUT
63
- fi
64
- fi
65
-
66
- - name : Sync from next branch to alpha branch
67
- if : steps.detect.outputs.has-changesets == 'false' && steps.check-pre-mode.outputs.alpha == 'true'
64
+ - name : Sync prerelease to alpha branch
65
+ if : steps.detect.outputs.has-changesets == 'false' && steps.pre.outputs.value == 'alpha'
68
66
uses : bluwy/auto-branch-sync-action@v1
69
67
with :
70
68
map : / -> alpha
71
69
skip-unchanged-check : ${{ inputs.skip-unchanged-check == true }}
72
70
dry-run : ${{ inputs.dry-run == true }}
73
71
74
- - name : Sync from next branch to beta branch
75
- if : steps.detect.outputs.has-changesets == 'false' && steps.check- pre-mode .outputs.beta == 'true '
72
+ - name : Sync prerelease to beta branch
73
+ if : steps.detect.outputs.has-changesets == 'false' && steps.pre.outputs.value == 'beta '
76
74
uses : bluwy/auto-branch-sync-action@v1
77
75
with :
78
76
map : / -> beta
79
77
skip-unchanged-check : ${{ inputs.skip-unchanged-check == true }}
80
78
dry-run : ${{ inputs.dry-run == true }}
81
79
82
- - name : Sync from next branch to rc branch
83
- if : steps.detect.outputs.has-changesets == 'false' && steps.check- pre-mode .outputs.rc == 'true '
80
+ - name : Sync prerelease to rc branch
81
+ if : steps.detect.outputs.has-changesets == 'false' && steps.pre.outputs.value == 'rc '
84
82
uses : bluwy/auto-branch-sync-action@v1
85
83
with :
86
84
map : / -> rc
0 commit comments