0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

GitHub ActionsでGoアプリをGoogle App Engineにデプロイする

Posted at

TL;DR

GitHub ActionsでGoアプリをGoogle App Engineにデプロイするには色々な方法が存在していたようだが,現在はGoogleの提供するgoogle-github-actions/setup-gcloudと言うActionを使うのが良いらしい.
https://github.com/google-github-actions/setup-gcloud

Secretsの設定

GCP_PROJECT_IDにGCPのプロジェクトIDを設定する.
GCP_SA_KEYにGCPのサービスアカウントの鍵を設定する.サービスアカウントはデフォルトのもので良い.別サービスから移行する場合は忘れずに過去の鍵を削除しておく.

workflowファイル

.github/workflows/deploy.yml
name: "Deploy"

on: 
  push:
    branches:
      - master

jobs:
  deploy:

    runs-on: ubuntu-latest

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    - name: Set up Cloud SDK
      uses: google-github-actions/setup-gcloud@master
      with:
        project_id: ${{ secrets.GCP_PROJECT_ID }}
        service_account_key: ${{ secrets.GCP_SA_KEY }}
        export_default_credentials: true

    - name: Use gcloud CLI
      run: gcloud app deploy --quiet app/web/app.yaml

最初--quietをつけ忘れてエラーになってしまった.

まとめ

思ったより簡単にGitHub Actionsに移行できた.みんな使おう!

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?