Files
setup-antigravity/action.yml
T
2026-07-20 16:07:52 +08:00

59 lines
3.2 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ============================================================================
# 用途:安裝 Antigravity CLI,並將 base64 編碼的 OAuth 憑證解碼寫入設定檔的 Gitea Composite Action。
# 更新時間:2026/07/20 15:55:12
# ============================================================================
# action 名稱,會顯示在 Gitea Actions 介面與被引用時的識別
name: 'Setup Antigravity'
# action 用途描述,說明此 action 的功能
description: '安裝 Antigravity CLI 並還原 OAuth 憑證的 Gitea Composite Action'
# action 作者
author: 'Jeffery'
# 輸入參數契約:呼叫端可透過 with 傳入的參數清單
inputs:
# oauthbase64 編碼的 OAuth 憑證字串,通常由呼叫端以 secret 傳入
oauth:
# 此輸入參數的說明
description: 'base64 編碼的 OAuth 憑證字串(解碼後寫入 Antigravity 憑證檔)'
# 必填;缺少憑證則無法完成設定
required: true
# 執行定義區塊:宣告此 action 的執行方式與步驟
runs:
# 執行型別為 composite(複合式 action,由多個 step 組成)
using: 'composite'
# 依序執行的步驟清單
steps:
# 啟動橫幅 step:於 action 開始時輸出名稱/用途/更新時間,方便日誌辨識
- name: 顯示 action 資訊
# 使用 bash 執行 run 內容
shell: bash
# 輸出啟動橫幅(分隔線與各欄位為刻意設計的啟動輸出,原樣保留)
run: |
echo "================================================"
echo "Action : Setup Antigravity"
echo "用途 : 安裝 Antigravity CLI 並還原 OAuth 憑證"
echo "更新時間: 2026/07/20 15:55:12"
echo "================================================"
# 安裝 Antigravity CLI(以官方安裝腳本,binary 安裝至 ~/.local/bin/agy
- name: 安裝 Antigravity CLI
# 使用 bash 執行 run 內容
shell: bash
# 步驟說明:
# 1. 以官方 install.sh 腳本安裝 Antigravity CLI(安裝出的 binary 名為 agy)。
# 2. 將 ~/.local/bin 寫入 $GITHUB_PATH,使後續 step 能在 PATH 中找到 agy
# install.sh 只改 shell profile,不會影響 runner 後續 step 的 PATH)。
# 3. 建立 antigravity → agy 的 symlink,提供以工具名稱呼叫的慣用指令
# (呼叫端以 antigravity 偵測/執行時可直接命中)。
run: |
curl -fsSL https://antigravity.google/cli/install.sh | bash
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
ln -sf "$HOME/.local/bin/agy" "$HOME/.local/bin/antigravity"
# 將 base64 OAuth 憑證解碼並寫入 Antigravity 憑證檔(單行:建目錄 → 解碼寫檔 → 限縮權限;不輸出憑證內容)
- name: 寫入 OAuth 憑證
# 使用 bash 執行 run 內容
shell: bash
# 環境變數:將輸入參數 oauth 帶入為環境變數供 run 使用(避免直接內嵌於指令列)
env:
OAUTH_B64: ${{ inputs.oauth }}
# 單行完成:mkdir 父目錄、base64 解碼寫入 OAuth token 檔、chmod 600 限縮權限
run: mkdir -p "$HOME/.gemini/antigravity-cli" && printf '%s' "$OAUTH_B64" | base64 -d > "$HOME/.gemini/antigravity-cli/antigravity-oauth-token" && chmod 600 "$HOME/.gemini/antigravity-cli/antigravity-oauth-token"