Skip to content

Commit 4258aa1

Browse files
committed
force USD release option
1 parent 5552739 commit 4258aa1

1 file changed

Lines changed: 29 additions & 39 deletions

File tree

.github/workflows/create-usd-release.yml

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -43,88 +43,78 @@ jobs:
4343
- uses: ilammy/msvc-dev-cmd@v1
4444
- name: Check if artifact exists in 'USD-${{ github.event.inputs.usd_version }}-Artifacts' Release
4545
id: check_artifact
46-
if: ${{ github.event.inputs.force == 'false' }}
4746
shell: pwsh
4847
run: |
49-
$usd_version="${{ github.event.inputs.usd_version }}"
50-
$usdFormattedVersion="$($usd_version.Substring(0,2)).$($usd_version.Substring(2))"
51-
"USD_FORMATTED_VERSION=$usdFormattedVersion" | Out-File -FilePath $env:GITHUB_ENV -Append
52-
$releaseName="USD-${{ github.event.inputs.usd_version }}-Artifacts"
53-
$ASSET_NAME="usd-${{ github.event.inputs.usd_version }}-${{ matrix.os }}.zip"
54-
$releaseExists = $false
55-
$stderr = $null
56-
$releaseView = gh release view $releaseName 2>&1 | Tee-Object -Variable stderr
57-
if ($stderr -match "release not found") {
58-
$releaseExists = $false
59-
"exists=false" | Out-File -FilePath $env:GITHUB_ENV -Append
60-
Write-Output "Release not found: $releaseName -- Creating new one"
61-
gh release create $releaseName --notes "USD built with the following parameters: --build-shared --openimageio --tools --python --debug-python --usd-imaging --build-variant release --use-cxx11-abi=0 (linux)"
48+
$force = "${{ github.event.inputs.force }}"
49+
$usd_version = "${{ github.event.inputs.usd_version }}"
50+
$releaseName = "USD-$usd_version-Artifacts"
51+
if ($force -eq 'true') {
52+
gh release delete $releaseName --yes
53+
echo "exists=false" >> $GITHUB_ENV
54+
Write-Output "Forced deletion of release: $releaseName"
6255
} else {
63-
$releaseExists = $true
64-
}
65-
Write-Output "Release View result: $releaseName, Exists: $releaseExists"
66-
if ($releaseExists) {
67-
$assets = gh release view $releaseName --repo ${{ github.repository }} --json assets -q '.assets[].name'
68-
if ($assets -like "*$ASSET_NAME*") {
69-
Write-Output "Asset $ASSET_NAME exists in the $releaseName Release."
70-
"exists=true" | Out-File -FilePath $env:GITHUB_ENV -Append
56+
$stderr = $null
57+
gh release view $releaseName 2>&1 | Tee-Object -Variable stderr
58+
if ($stderr -match "release not found") {
59+
echo "exists=false" >> $GITHUB_ENV
60+
Write-Output "Release not found: $releaseName -- Creating new one"
61+
gh release create $releaseName --notes "USD built with the following parameters: --build-shared --openimageio --tools --python --debug-python --usd-imaging --build-variant release --use-cxx11-abi=0 (linux)"
7162
} else {
72-
Write-Output "Asset $ASSET_NAME does not exist in the $releaseName Release."
73-
"exists=false" | Out-File -FilePath $env:GITHUB_ENV -Append
63+
echo "exists=true" >> $GITHUB_ENV
7464
}
7565
}
7666
env:
7767
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7868

7969
- name: Set up Python
80-
if: env.exists == 'false' || ${{ github.event.inputs.force == 'true' }}
70+
if: env.exists == 'false'
8171
uses: actions/setup-python@v5
8272
with:
8373
python-version: '3.10.11'
8474
id: setup-python
8575

8676
- name: Install Ninja (Cross-platform)
87-
if: env.exists == 'false' || ${{ github.event.inputs.force == 'true' }}
77+
if: env.exists == 'false'
8878
run: |
8979
python -m pip install ninja
9080
9181
- name: Install Additional Dependencies (macOS-13)
92-
if: (env.exists == 'false' || ${{ github.event.inputs.force == 'true' }}) && ${{ matrix.os == 'macOS-13' }}
82+
if: env.exists == 'false' && matrix.os == 'macOS-13'
9383
run: |
9484
sudo xcode-select -s /Applications/Xcode_14.1.app
9585
brew uninstall --ignore-dependencies openexr imath
9686
brew cleanup
9787
brew install glew
9888
9989
- name: Install Additional Dependencies (macOS-14)
100-
if: (env.exists == 'false' || ${{ github.event.inputs.force == 'true' }}) && ${{ matrix.os == 'macOS-14' }}
90+
if: env.exists == 'false' && matrix.os == 'macOS-14'
10191
run: |
10292
brew uninstall --ignore-dependencies giflib
10393
brew cleanup
10494
10595
- name: Install Additional Dependencies (Ubuntu)
106-
if: (env.exists == 'false' || ${{ github.event.inputs.force == 'true' }}) && ${{ matrix.os == 'ubuntu-22.04' }}
96+
if: env.exists == 'false' && matrix.os == 'ubuntu-22.04'
10797
run: |
10898
sudo apt-get update
10999
sudo apt-get install -y build-essential libgl1-mesa-dev libglew-dev libxi-dev libxrandr-dev
110100
111101
- name: Install Additional Dependencies (Windows)
112-
if: (env.exists == 'false' || ${{ github.event.inputs.force == 'true' }}) && ${{ matrix.os == 'windows-2022' }}
102+
if: env.exists == 'false' && matrix.os == 'windows-2022'
113103
run: |
114104
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'
115105
116106
- name: Clone USD
117-
if: env.exists == 'false' || ${{ github.event.inputs.force == 'true' }}
107+
if: env.exists == 'false'
118108
run: git clone --branch v${{ env.USD_FORMATTED_VERSION }} --depth 1 https://github.com/PixarAnimationStudios/OpenUSD.git
119109

120110
- name: Install Python Dependencies
121-
if: env.exists == 'false' || ${{ github.event.inputs.force == 'true' }}
111+
if: env.exists == 'false'
122112
run: |
123113
python -m pip install PySide6
124114
python -m pip install pyopengl
125115
126116
- name: Build USD
127-
if: env.exists == 'false' || ${{ github.event.inputs.force == 'true' }}
117+
if: env.exists == 'false'
128118
shell: pwsh
129119
run: |
130120
$file = "OpenUSD/build_scripts/build_usd.py"
@@ -145,14 +135,14 @@ jobs:
145135
Invoke-Expression $python_cmd
146136
147137
- name: Remove Specific Folders Unix
148-
if: (env.exists == 'false' || ${{ github.event.inputs.force == 'true' }}) && ${{ matrix.os != 'windows-2022' }}
138+
if: env.exists == 'false' && matrix.os != 'windows-2022'
149139
run: |
150140
rm -rf ${{ github.workspace }}/usd_build/build
151141
rm -rf ${{ github.workspace }}/usd_build/share
152142
rm -rf ${{ github.workspace }}/usd_build/src
153143
154144
- name: Remove Specific Folders Windows
155-
if: (env.exists == 'false' || ${{ github.event.inputs.force == 'true' }}) && ${{ matrix.os == 'windows-2022' }}
145+
if: env.exists == 'false' && matrix.os == 'windows-2022'
156146
run: |
157147
powershell -Command "& {
158148
Remove-Item -Path ${{ github.workspace }}\usd_build\build -Recurse -Force
@@ -161,7 +151,7 @@ jobs:
161151
}"
162152
163153
- name: Set USD Paths to Environment variable to USD_BUILD_PATH
164-
if: env.exists == 'false' || ${{ github.event.inputs.force == 'true' }}
154+
if: env.exists == 'false'
165155
shell: pwsh
166156
run: |
167157
if ($env:RUNNER_OS -eq 'macOS') {
@@ -184,21 +174,21 @@ jobs:
184174
}
185175
186176
- name: Package Build Artifacts Unix
187-
if: (env.exists == 'false' || ${{ github.event.inputs.force == 'true' }}) && ${{ matrix.os != 'windows-2022' }}
177+
if: env.exists == 'false' && matrix.os != 'windows-2022'
188178
run: |
189179
cd ${{ github.workspace }}/usd_build
190180
zip -r ../usd-${{ github.event.inputs.usd_version }}-${{ matrix.os }}.zip *
191181
192182
- name: Package Build Artifacts Windows
193-
if: (env.exists == 'false' || ${{ github.event.inputs.force == 'true' }}) && ${{ matrix.os == 'windows-2022' }}
183+
if: env.exists == 'false' && matrix.os == 'windows-2022'
194184
run: |
195185
powershell -Command "& {
196186
Set-Location ${{ github.workspace }}\usd_build
197187
Compress-Archive -Path * -DestinationPath ..\usd-${{ github.event.inputs.usd_version }}-${{ matrix.os }}.zip
198188
}"
199189
200190
- name: Upload Artifact to USD-${{ github.event.inputs.usd_version }}-Artifacts Release
201-
if: env.exists == 'false' || ${{ github.event.inputs.force == 'true' }}
191+
if: env.exists == 'false'
202192
shell: pwsh
203193
run: |
204194
$ARTIFACT_PATH="${{ github.workspace }}/usd-${{ github.event.inputs.usd_version }}-${{ matrix.os }}.zip"

0 commit comments

Comments
 (0)