feat(deploy): add sync and push scripts for CI/CD
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Git commit + push to Gitea (no sensitive data; credentials come from git config or env).
|
||||
|
||||
.DESCRIPTION
|
||||
Stages all changes, commits with a timestamp message, and force-pushes to origin/main.
|
||||
Run from the repo root or any subdirectory.
|
||||
|
||||
Remote URL is whatever `git remote get-url origin` returns — configure it once:
|
||||
git remote set-url origin https://<user>@<host>/arash/audio-voice-converter.git
|
||||
|
||||
.PARAMETER Message
|
||||
Optional commit message. Defaults to "chore: sync extension files <timestamp>".
|
||||
|
||||
.PARAMETER DryRun
|
||||
Show what would be committed/pushed without actually doing it.
|
||||
|
||||
.EXAMPLE
|
||||
.\deploy\scripts\push.ps1
|
||||
.\deploy\scripts\push.ps1 -Message "feat: update popup UI"
|
||||
.\deploy\scripts\push.ps1 -DryRun
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string]$Message,
|
||||
[switch]$DryRun
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# Navigate to repo root (2 levels up from deploy/scripts/)
|
||||
$repoRoot = Split-Path (Split-Path $PSScriptRoot)
|
||||
Set-Location $repoRoot
|
||||
|
||||
$status = git status --porcelain
|
||||
if (-not $status) {
|
||||
Write-Host "Nothing to commit."
|
||||
exit 0
|
||||
}
|
||||
|
||||
$msg = if ($Message) { $Message } else { "chore: sync extension files $(Get-Date -Format 'yyyy-MM-dd HH:mm')" }
|
||||
|
||||
Write-Host "Changes to commit:"
|
||||
git status --short
|
||||
|
||||
if ($DryRun) {
|
||||
Write-Host "[DryRun] Would commit: $msg"
|
||||
Write-Host "[DryRun] Would push: origin main (force)"
|
||||
exit 0
|
||||
}
|
||||
|
||||
git add .
|
||||
git commit -m $msg
|
||||
git push --force origin main
|
||||
|
||||
Write-Host "Push complete."
|
||||
@@ -0,0 +1,50 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sync extension source files into this repo (no git operations).
|
||||
|
||||
.DESCRIPTION
|
||||
Copies the latest files from the source directories into the repo.
|
||||
Source root is read from $env:AUDIO_SOURCE_ROOT (no sensitive data in this script).
|
||||
|
||||
Source layout expected under $env:AUDIO_SOURCE_ROOT:
|
||||
Google Meet Transcripts & AI Summary/ -> google-meet-transcripts-extension/
|
||||
caption-extension/ -> caption-extension/
|
||||
|
||||
.EXAMPLE
|
||||
$env:AUDIO_SOURCE_ROOT = "D:\projects\google_meet_captions"
|
||||
.\deploy\scripts\sync.ps1
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param()
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$sourceRoot = $env:AUDIO_SOURCE_ROOT
|
||||
if (-not $sourceRoot) {
|
||||
Write-Error "Set `$env:AUDIO_SOURCE_ROOT` to the google_meet_captions folder before running."
|
||||
}
|
||||
|
||||
$repoRoot = Split-Path (Split-Path $PSScriptRoot) # deploy/scripts -> repo root
|
||||
|
||||
$mappings = @(
|
||||
@{
|
||||
From = Join-Path $sourceRoot "Google Meet Transcripts & AI Summary"
|
||||
To = Join-Path $repoRoot "google-meet-transcripts-extension"
|
||||
},
|
||||
@{
|
||||
From = Join-Path $sourceRoot "caption-extension"
|
||||
To = Join-Path $repoRoot "caption-extension"
|
||||
}
|
||||
)
|
||||
|
||||
foreach ($m in $mappings) {
|
||||
if (-not (Test-Path $m.From)) {
|
||||
Write-Warning "Source not found, skipping: $($m.From)"
|
||||
continue
|
||||
}
|
||||
Write-Host "Syncing $($m.From) -> $($m.To)"
|
||||
New-Item -ItemType Directory -Force -Path $m.To | Out-Null
|
||||
Copy-Item "$($m.From)\*" $m.To -Recurse -Force
|
||||
}
|
||||
|
||||
Write-Host "Sync complete."
|
||||
Reference in New Issue
Block a user