이 가이드에서는 일반적인 사용 시나리오에서 gactions 명령줄 인터페이스 (CLI) 도구를 사용하는 방법을 보여줍니다. 작업 엔드 투 엔드 빌드에 관한 자세한 내용은 대화형 작업 빌드 문서를 참고하세요.
프로젝트 동기화
Actions SDK를 사용할 때 gactions는 Actions 콘솔과 로컬 파일 시스템 간에 작업 프로젝트를 동기화하는 도구입니다.
gactions pull
작업은 Actions 콘솔에서 로컬 파일 시스템으로 프로젝트를 내보내고 gactions push
작업은 로컬 파일 시스템에서 Actions 콘솔로 프로젝트를 푸시합니다.
Actions 콘솔에서 작업 다운로드
gactions pull
를 실행하여 작업 프로젝트의 구성을 로컬 파일 시스템에 복사합니다.
복사할 프로젝트의 project-id
를 명령줄에서 전달하거나 settings/settings.yaml
파일에 작성할 수 있습니다. 둘 다 있으면 CLI는 옵션으로 전달된 값을 우선 적용합니다.
mkdir -p myAction/sdk
cd myAction/sdk
gactions pull --project-id my-project-id
Pulling your project files from Draft for a project id: "my-project-id" ✔ Done. You should see the files written in path/to/myAction/sdkls -l
total 8 drwxr-x--- 3 user primarygroup 96 May 7 10:00 actions drwxr-x--- 4 user primarygroup 128 May 7 10:00 custom -rw-r----- 1 user primarygroup 15 May 7 10:00 manifest.yaml drwxr-x--- 3 user primarygroup 96 May 7 10:00 settingsvi settings/settings.yaml
// change projectId to "my-other-project-id"gactions pull
Pulling your project files from Draft for a project id: "my-other-project-id" path/to/myAction/sdk/manifest.yaml already exists. Would you like to overwrite it?. [y/n] ... ✔ Done. You should see the files written in path/to/myAction/sdk
위의 코드 스니펫은 프로젝트 초안에서 작업을 가져오는 방법을 보여줍니다. 작업의 특정 버전에서 가져올 수도 있습니다. 버전은 출시 채널에 배포할 수 있는 작업 프로젝트의 제출된 사본을 나타냅니다.
--version-id
플래그는 가져올 버전을 지정합니다.
mkdir -p myAction/sdk
cd myAction/sdk
gactions pull --project-id my-project-id --version-id my-version-id
Pulling version "my-version-id" of the project "my-project-id" from Actions Console... ✔ Done. You should see the files written in path/to/myAction/sdkls -l
total 8 drwxr-x--- 3 user primarygroup 96 May 7 10:00 actions drwxr-x--- 4 user primarygroup 128 May 7 10:00 custom -rw-r----- 1 user primarygroup 15 May 7 10:00 manifest.yaml drwxr-x--- 3 user primarygroup 96 May 7 10:00 settings
확인 메시지 없이 파일의 로컬 사본을 덮어쓰려면 --force
플래그를 사용합니다. 원격 초안 또는 버전에 없는 로컬 파일을 삭제하려면 --clean
플래그를 사용합니다. 이를 함께 사용하여 Actions 콘솔 프로젝트의 정확한 사본을 얻을 수 있습니다.
touch local_file.txt
gactions pull --force
Pulling your project files from Draft for a project id: "my-project-id" [WARNING] 2020/05/07 17:34:32 path/to/myAction/sdk/local_file.txt is not present in the draft of your Action. To remove, run pull with --clean flag. ✔ Done. You should see the files written in path/to/myAction/sdkgactions pull --force --clean
Pulling your project files from Draft for a project id: "my-project-id" [WARNING] 2020/05/07 17:43:44 path/to/myAction/sdk/local_file.txt is not present in the draft of your Action. Removing path/to/myAction/sdk/local_file.txt. ✔ Done. You should see the files written in path/to/myAction/sdk
액션으로 푸시 액션 콘솔 프로젝트 초안
gactions push
를 실행하여 콘솔의 로컬 파일 시스템에서 작업의 초안으로 변경사항을 푸시합니다. 이 프로세스는 개발 중에 테스트를 위해 제공되는 버전에 영향을 주지 않고 Actions 콘솔에 반영된 변경사항을 확인하는 데 유용할 수 있습니다.
gactions push
Pushing your project files to your Actions console draft for a project id: "my-project-id". This may take a few minutes.
Sending configuration files
Waiting for server to respond.
✔ Done. You can now navigate to the Actions Console: https://console.actions.google.com/project/my-project-id/overview to view your project. If you want to test your changes in the simulator, run "gactions deploy preview"
소스 코드 관리 시스템에서 기존 프로젝트 가져오기
버전 제어 시스템의 버전에서 기존 프로젝트를 작업하려면 다음 안내를 따르세요.
- 대상 버전을 확인합니다 (시스템에 따라 다름).
- 프로젝트의
settings.yaml
에서projectId
값을 바꿉니다. - 필요한 경우
gactions push
를 실행하여 로컬 구성 파일을 작업 프로젝트에 복사합니다.
git clone https://github.com/my/repo.git
Cloning into 'repo'... remote: Enumerating objects: 10, done. remote: Counting objects: 100% (10/10), done. remote: Compressing objects: 100% (9/9), done. remote: Total 51 (delta 3), reused 3 (delta 1), pack-reused 41 Receiving objects: 100% (51/51), 36.86 KiB | 3.69 MiB/s, done. Resolving deltas: 100% (11/11), done.cd repo/sdk/
vi settings/settings.yaml
// change the value of `projectId`gactions push
버전 나열
gactions versions list
를 실행하여 작업 버전에 관한 세부정보를 확인합니다.
버전 상태에 관한 자세한 내용은 상태 참조를 확인하세요.
gactions versions list
Version Status Last Modified By Modified On
1 Created your-email@your-domain.com 2020-09-28 20:22:04
배포 상태가 '생성 실패'로 표시되면 콘솔의 '출시' 섹션에서 자세한 내용을 확인할 수 있습니다.
프로젝트 배포
gactions deploy
명령어를 사용하면 작업 시뮬레이터에서 테스트할 프로젝트를 배포하거나 알파/베타/프로덕션 출시 채널에 배포할 수 있습니다.
시뮬레이터에서 미리보기
gactions deploy preview
를 실행하여 작업을 '미리보기'에 배포합니다. 이렇게 하면 실제로 작업 프로젝트의 버전을 업데이트하거나 다른 개발자에게 영향을 주지 않고도 콘솔에서 작업을 테스트할 수 있습니다. 즉, 로컬 파일 시스템에서 변경한 사항은 작업 프로젝트의 배포된 버전에 전파되지 않지만 미리보기 버전에서 테스트할 수 있습니다.
gactions deploy preview
Deploying your project files to your Actions console preview for a project id: "my-project". This may take a few minutes.
Sending configuration files
Waiting for server to respond.
✔ Done. You can now navigate to the Actions Console simulator to test your changes: http://console.actions.google.com/project/my-project/simulator?disableAutoPreview
출시 버전 만들기
gactions deploy
를 실행하여 Actions 콘솔의 배포 섹션을 통해 관리할 수 있는 알파/베타/프로덕션 채널의 버전 출시 버전을 만듭니다.
이를 사용하여 알파 또는 베타 채널에서 작업의 출시 후보를 테스트하고, 의견에 만족하면 출시 후보를 프로덕션으로 이동하세요.
gactions deploy alpha
Deploying your project files to a actions.channels.Alpha channel for a project id: "my-project-id"
Sending configuration files
Waiting for server to respond.
✔ Done. Your Action was deployed to actions.channels.Alpha channel. You can check status of deployment in the Actions Console.
출시 채널 나열
gactions release-channels list
를 실행하여 작업의 출시 채널에 관한 세부정보를 확인합니다. 이 명령어를 사용하면 각 채널에 배포되었거나 대기 중인 버전을 식별할 수 있습니다.
gactions release-channels list
Release Channel Current Version Pending Version
alpha 1 N/A
계정 연결
gactions encrypt
및 gactions decrypt
명령어를 사용하면 OAuth2 클라이언트 보안 비밀번호를 관리할 수 있습니다. 다음은 계정 연결과 관련된 명령어입니다.
OAuth2 계정 연결 클라이언트 보안 비밀번호 암호화
gactions encrypt
를 실행하여 인증 코드 OAuth2 계정 연결 흐름을 위해 클라이언트 보안 비밀번호를 안전하게 추가하거나 새 암호화 키로 기존 보안 비밀을 암호화합니다.
gactions encrypt
Write your secret: *********************
Encrypting your client secret
path/to/myAction/sdk/settings/accountLinkingSecret.yaml already exists. Would you like to overwrite it?. [y/n]
y
✔ Done. Encrypted secret was written to path/to/myAction/sdk/settings/accountLinkingSecret.yaml
암호화된 계정 연결 보안 비밀의 일반 텍스트 값에 액세스합니다.
프로젝트 보안 비밀의 일반 텍스트 값에 일시적으로 액세스해야 하는 경우 gactions decrypt
를 실행합니다. 이 명령어는 값을 선택한 텍스트 파일에 출력합니다.
일반 텍스트 값이 실수로 유출되지 않도록 하려면 대상 파일을 프로젝트의 루트 폴더 외부에 두는 것이 좋습니다.
gactions decrypt ../../burn_after_read.txt
Decrypting your client secret ✔ Done. Check path/above/myActions/burn_after_read.txt to find decrypted client secret.vi ../../burn_after_read.txt
rm ../../burn_after_read.txt