【亲测免费】 Google Cloud SDK 安装与配置 GitHub Action 教程
2026-01-22 04:47:08作者:苗圣禹Peter
1. 项目目录结构及介绍
.
├── dist/
├── src/
├── tests/
├── .gitignore
├── .prettierrc.js
├── CHANGELOG.md
├── CODEOWNERS
├── LICENSE
├── README.md
├── action.yml
├── eslint.config.mjs
├── package-lock.json
├── package.json
└── tsconfig.json
目录结构介绍
- dist/: 存放编译后的文件。
- src/: 存放源代码文件。
- tests/: 存放测试文件。
- .gitignore: Git 忽略文件配置。
- .prettierrc.js: Prettier 代码格式化配置文件。
- CHANGELOG.md: 项目更新日志。
- CODEOWNERS: 代码所有者配置文件。
- LICENSE: 项目许可证文件。
- README.md: 项目说明文档。
- action.yml: GitHub Action 配置文件。
- eslint.config.mjs: ESLint 配置文件。
- package-lock.json: npm 包锁定文件。
- package.json: npm 包管理文件。
- tsconfig.json: TypeScript 配置文件。
2. 项目的启动文件介绍
项目的启动文件是 action.yml,这是一个 GitHub Action 的配置文件。它定义了 Action 的输入、输出、运行环境等信息。
action.yml 文件内容
name: 'Setup Google Cloud SDK'
description: 'A GitHub Action for installing and configuring the gcloud CLI'
inputs:
version:
description: 'A string representing the version or version constraint of the Cloud SDK (gcloud) to install'
default: 'latest'
project_id:
description: 'ID of the Google Cloud project'
install_components:
description: 'List of additional gcloud components to install'
skip_install:
description: 'Skip installation of gcloud and use the system-supplied version instead'
outputs:
version:
description: 'Version of gcloud that was installed'
runs:
using: 'node20'
main: 'dist/index.js'
启动文件介绍
- name: Action 的名称。
- description: Action 的描述。
- inputs: 定义了 Action 的输入参数,如
version、project_id等。 - outputs: 定义了 Action 的输出参数,如
version。 - runs: 定义了 Action 的运行环境及主文件路径。
3. 项目的配置文件介绍
.prettierrc.js
module.exports = {
semi: true,
trailingComma: 'all',
singleQuote: true,
printWidth: 80,
tabWidth: 2,
};
tsconfig.json
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
}
eslint.config.mjs
export default [
{
files: ['**/*.js', '**/*.mjs', '**/*.jsx', '**/*.ts', '**/*.tsx'],
rules: {
'no-unused-vars': 'error',
'no-console': 'warn',
},
},
];
配置文件介绍
- .prettierrc.js: 配置代码格式化工具 Prettier,定义了代码风格规则。
- tsconfig.json: 配置 TypeScript 编译选项,定义了编译目标、模块系统、严格模式等。
- eslint.config.mjs: 配置 ESLint,定义了代码检查规则。
通过以上配置文件,项目可以确保代码风格一致、编译正确、代码质量高。
登录后查看全文
热门项目推荐
相关项目推荐
GLM-5智谱 AI 正式发布 GLM-5,旨在应对复杂系统工程和长时域智能体任务。Jinja00
LongCat-AudioDiT-1BLongCat-AudioDiT 是一款基于扩散模型的文本转语音(TTS)模型,代表了当前该领域的最高水平(SOTA),它直接在波形潜空间中进行操作。00
jiuwenclawJiuwenClaw 是一款基于openJiuwen开发的智能AI Agent,它能够将大语言模型的强大能力,通过你日常使用的各类通讯应用,直接延伸至你的指尖。Python0245- QQwen3.5-397B-A17BQwen3.5 实现了重大飞跃,整合了多模态学习、架构效率、强化学习规模以及全球可访问性等方面的突破性进展,旨在为开发者和企业赋予前所未有的能力与效率。Jinja00
AtomGit城市坐标计划AtomGit 城市坐标计划开启!让开源有坐标,让城市有星火。致力于与城市合伙人共同构建并长期运营一个健康、活跃的本地开发者生态。01
HivisionIDPhotos⚡️HivisionIDPhotos: a lightweight and efficient AI ID photos tools. 一个轻量级的AI证件照制作算法。Python05
项目优选
收起
deepin linux kernel
C
27
13
OpenHarmony documentation | OpenHarmony开发者文档
Dockerfile
641
4.19 K
Ascend Extension for PyTorch
Python
478
579
本项目是CANN提供的数学类基础计算算子库,实现网络在NPU上加速计算。
C++
934
841
openEuler内核是openEuler操作系统的核心,既是系统性能与稳定性的基石,也是连接处理器、设备与服务的桥梁。
C
386
272
🎉 (RuoYi)官方仓库 基于SpringBoot,Spring Security,JWT,Vue3 & Vite、Element Plus 的前后端分离权限管理系统
Vue
1.52 K
866
暂无简介
Dart
885
211
仓颉编程语言运行时与标准库。
Cangjie
161
922
昇腾LLM分布式训练框架
Python
139
163
🔥LeetCode solutions in any programming language | 多种编程语言实现 LeetCode、《剑指 Offer(第 2 版)》、《程序员面试金典(第 6 版)》题解
Java
69
21