Skip to content

Commit

Permalink
Properly check CI flag
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeNaccarato committed Sep 16, 2024
1 parent 9b3c703 commit cc61274
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
with:
python-version: "${{ matrix.python }}"
- run: "scripts/Sync-Py.ps1 -Release"
- run: "bin/uv build"
- run: "uv build"
- uses: actions/attest-build-provenance@5e9cb68e95676991667494a6a4e59b8a2f13e1d0 # v1.3.3
with:
subject-path: "dist/**"
Expand Down
2 changes: 1 addition & 1 deletion scripts/Common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function Sync-Uv {
$Sep = $IsWindows ? ';' : ':'
$Env:PATH = "$(Get-Item 'bin')$Sep$Env:PATH"
$EnvFile = $Env:GITHUB_ENV ? $Env:GITHUB_ENV : '.env'
if ($CI) {
if ($Env:CI) {
("PATH=$Env:PATH", "UV_TOOL_BIN_DIR=$Bin") | Add-Content $EnvFile
}
# ? Install `uv`
Expand Down
2 changes: 1 addition & 1 deletion scripts/Initialize-Shell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function Set-Env {

# ? Sync the virtual environment
Sync-Uv
if (!$CI) {
if (!$Env:CI) {
if (!(Test-Path '.venv')) { uv venv --python $Version }
if ($IsWindows) { .venv/scripts/activate.ps1 } else { .venv/bin/activate.ps1 }
if (!(python --version | Select-String -Pattern $([Regex]::Escape($Version)))) {
Expand Down
11 changes: 5 additions & 6 deletions scripts/Sync-Py.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ Param(

'CHECKING ENVIRONMENT TYPE' | Write-Progress
$High = $High ? $High : [bool]$Env:SYNC_PY_HIGH
$CI = $Env:SYNC_PY_DISABLE_CI ? $null : $Env:CI
$Devcontainer = $Env:SYNC_PY_DISABLE_DEVCONTAINER ? $null : $Env:DEVCONTAINER
if (!$Release -and $CI) { $msg = 'CI' }
if (!$Release -and $Env:CI) { $msg = 'CI' }
elseif ($Devcontainer) { $msg = 'devcontainer' }
elseif ($Release) { $msg = 'release' }
"Will run $msg steps" | Write-Progress -Info
Expand All @@ -29,7 +28,7 @@ if ($Release) {
return
}

if (!$CI -and !$Devcontainer -and
if (!$Env:CI -and !$Devcontainer -and
(Get-Command -Name 'code' -ErrorAction 'Ignore') -and
($Env:PYRIGHT_PYTHON_PYLANCE_VERSION)
) {
Expand Down Expand Up @@ -59,7 +58,7 @@ if (!$CI -and !$Devcontainer -and
}
}
'*** RUNNING PRE-SYNC TASKS' | Write-Progress
if ($CI) {
if ($Env:CI) {
'SYNCING PROJECT WITH TEMPLATE' | Write-Progress
context_models_tools elevate-pyright-warnings
try { scripts/Sync-Template.ps1 -Stay } catch [System.Management.Automation.NativeCommandExitException] {
Expand All @@ -78,7 +77,7 @@ if ($Devcontainer) {
if (!($safeDirs -contains $dir)) { git config --global --add safe.directory $dir }
}
}
if (!$CI) {
if (!$Env:CI) {
'SYNCING SUBMODULES' | Write-Progress
Get-ChildItem '.git/modules' -Filter 'config.lock' -Recurse -Depth 1 | Remove-Item
git submodule update --init --merge
Expand All @@ -92,7 +91,7 @@ context_models_tools compile $($High ? '--high' : '--no-high') | uv pip sync -
'DEPENDENCIES SYNCED' | Write-Progress -Done

'*** RUNNING POST-SYNC TASKS' | Write-Progress
if (!$CI) {
if (!$Env:CI) {
'INSTALLING PRE-COMMIT HOOKS' | Write-Progress
pre-commit install
'PRE-COMMIT HOOKS INSTALLED' | Write-Progress -Done
Expand Down

0 comments on commit cc61274

Please sign in to comment.