【Github Actions, GCS】GithubActionsでCloud Storageにファイルをアップロードする

スポンサーリンク

Github ActionsからGCSにzipファイルをアップロードするyamlファイルの例です。

setup-gcloud@master にはGCPの認証情報を設定します。

name: workflow

on:
  pull_request:
    branches: [ master ]
  workflow_dispatch:

jobs:
  upload_file_gcs:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - 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: create zip
        working-directory: ./
        run: zip -r ./functions.zip ./functions/function.go ./go.mod
      - id: upload-file
        uses: google-github-actions/upload-cloud-storage@main
        with:
          path: ./functions.zip
          destination: bucket_name/functions

参考

Cloud Storage Uploader - GitHub Marketplace
Upload files or folders to GCS buckets

未経験、異業種からIT業界に転身。フロントエンジニア。主にJavascript(React.js)をつかったWEBアプリ開発にたずさわる。
お問い合わせ、ご相談など → genpsp10@gmail.com

psp7をフォロー
プログラミング
スポンサーリンク
psp7をフォロー
ハトらぼ

コメント