Fix tagged build detection for binary builds (#72628)
Summary:
Should fix the following [error](https://github.com/pytorch/pytorch/runs/5058514346#step:13:88):
```
+ git --git-dir /pytorch/pytorch/.git describe --tags --match 'v[0-9]*.[0-9]*.[0-9]*' --exact
fatal: not a git repository: '/pytorch/pytorch/.git'
```
By setting `workdir` correctly for GHA linux and Windows builds
Also, abort `tagged_version` if GIT_DIR does not exist (as this script should only be executed in context of git folder.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72628
Reviewed By: atalman
Differential Revision: D34120721
Pulled By: malfet
fbshipit-source-id: 035e93e243e601f9c24659cd247f9c029210fba5
(cherry picked from commit 3a6c97b6ddb185d706494f64423a761fee8fce09)