@@ -507,6 +507,8 @@ jobs:
507507 runs-on :
508508 group : ansys-network
509509 labels : [self-hosted, Windows, signtool]
510+ env :
511+ REUSE_LAST_ARTIFACTS : ${{ vars.REUSE_LAST_ARTIFACTS == 1 }}
510512
511513 steps :
512514 - name : Check out repository pyansys-geometry-binaries
@@ -515,11 +517,28 @@ jobs:
515517 repository : ' ansys/pyansys-geometry-binaries'
516518 token : ${{ secrets.BINARIES_TOKEN }}
517519
518- - name : Download binaries
520+ - name : Download binaries (if conditions met)
521+ if : env.REUSE_LAST_ARTIFACTS == 'false'
519522 run : |
520523 curl.exe -X GET -H "X-JFrog-Art-Api: ${{ secrets.ARTIFACTORY_KEY }}" ${{ secrets.ARTIFACTORY_URL }}/${{ env.ARTIFACTORY_VERSION }}/DockerWindows.zip --output windows-binaries.zip
521524 curl.exe -X GET -H "X-JFrog-Art-Api: ${{ secrets.ARTIFACTORY_KEY }}" ${{ secrets.ARTIFACTORY_URL }}/${{ env.ARTIFACTORY_VERSION }}/DockerLinux.zip --output linux-binaries.zip
522525
526+ - name : Reuse last binaries (if conditions met)
527+ if : env.REUSE_LAST_ARTIFACTS == 'true'
528+ env :
529+ VERSION_WITH_PREFIX : ${{ github.ref_name }}
530+ run : |
531+ # We are on a Windows machine. We need to copy the binaries from the previous tag,
532+ # based on the current tag. We will also remove the trailing "v" from the tag. This will give
533+ # us the folder from where we need to copy the binaries.
534+ $env:VERSION=$env:VERSION_WITH_PREFIX.substring(1)
535+ $env:PREVIOUS_VERSION=$env:VERSION.substring(0, $env:VERSION.Length - 1)
536+ $env:PREVIOUS_PATCH_VERSION_NUMBER=$env:VERSION.substring($env:VERSION.Length - 1)
537+ $env:PREVIOUS_PATCH_VERSION_NUMBER=[int]$env:PREVIOUS_PATCH_VERSION_NUMBER - 1
538+ $env:PREVIOUS_VERSION=$env:PREVIOUS_VERSION + $env:PREVIOUS_PATCH_VERSION_NUMBER
539+ cp ./$env:PREVIOUS_VERSION/windows-binaries.zip windows-binaries.zip
540+ cp ./$env:PREVIOUS_VERSION/linux-binaries.zip linux-binaries.zip
541+
523542 - name : Upload Windows binaries as workflow artifacts
524543 uses : actions/upload-artifact@v4
525544 with :
0 commit comments