@@ -33,30 +33,19 @@ inputs:
33
33
description : ' Is this package in preview?'
34
34
required : false
35
35
default : ' false'
36
+ upm-branch :
37
+ description : ' The branch to use for the UPM release. (Defaults to upm)'
38
+ required : false
39
+ default : ' upm'
36
40
37
41
runs :
38
42
using : " composite"
39
43
steps :
40
- - id : target
41
- name : Set target branch
42
- if : ${{ github.ref != 'refs/heads/upm' && github.base_ref != 'upm' }}
43
- run : |
44
- $isPreview = '${{ github.base_ref == 'main' }}'
45
-
46
- if ($isPreview -eq 'true') {
47
- $branch = '${{ github.head_ref }}'
48
- } else {
49
- $branch = '${{ github.ref }}'
50
- }
51
-
52
- "BRANCH=$branch" >> $env:GITHUB_ENV
53
- shell : pwsh
54
-
55
44
- uses : actions/checkout@v4
56
45
if : ${{ github.ref != 'refs/heads/upm' && github.base_ref != 'upm' }}
57
46
with :
58
47
token : ${{ inputs.github-token }}
59
- ref : ${{ env.BRANCH }}
48
+ ref : ${{ inputs.upm-branch }}
60
49
fetch-depth : 0
61
50
62
51
99
88
name : Validate Package Version
100
89
run : |
101
90
# validate version
102
- $branch = '${{ env.BRANCH }}'
91
+ $branch = '${{ inputs.upm-branch }}'
92
+
93
+ if ([string]::IsNullOrEmpty($branch)) {
94
+ Write-Error "Failed to determine the branch to use for pushing the release."
95
+ exit 1
96
+ }
97
+
98
+ Write-Host "::debug::Release Branch: $branch"
99
+
103
100
$isPreview = '${{ github.base_ref == 'main' || inputs.preview == 'true' }}'
104
101
105
102
$packageDir = Get-Item -Path "${{ inputs.package-root }}" | Select-Object -ExpandProperty FullName
@@ -188,18 +185,31 @@ runs:
188
185
"VERSION=$version" >> $env:GITHUB_ENV
189
186
$packageInfo | ConvertTo-Json | Set-Content $packageFile
190
187
188
+ Write-Host "::debug::set git config"
189
+ git config user.email "github-actions[bot]@users.noreply.github.com"
190
+ git config user.name "GitHub Actions"
191
+
192
+ Write-Host "::debug::check current status"
191
193
git status
194
+ Write-Host "::debug::checkout $branch"
192
195
git checkout $branch
196
+ Write-Host "::debug::pull latest changes"
193
197
git pull
198
+ Write-Host "::debug::add package.json"
194
199
git add $packageFile
195
200
196
201
foreach ($file in $updatedFiles) {
197
202
git add $file
198
203
}
199
204
205
+ Write-Host "::debug::check current status"
200
206
git status
207
+ Write-Host "::debug::check branch"
208
+ git branch
209
+ Write-Host "::debug::commit version changes"
201
210
git commit -m "[skip ci] $version"
202
- git push https://${{ inputs.github-username }}:$env:[email protected] /${{ github.repository }}.git $branch --force
211
+ Write-Host "::debug::push version changes"
212
+ git push https://${{ inputs.github-token }}@github.com/${{ github.repository }}.git $branch --force
203
213
$exit = 0
204
214
205
215
if ($LASTEXITCODE -gt 0) {
@@ -210,8 +220,6 @@ runs:
210
220
exit $exit
211
221
shell : pwsh
212
222
working-directory : ${{ github.workspace }}
213
- env :
214
- GITHUB_TOKEN : ${{ inputs.github-token }}
215
223
216
224
-
uses :
RageAgainstThePixel/[email protected]
217
225
if : ${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && env.VERSION != '' }}
0 commit comments