CDソース追加(gcp )
This commit is contained in:
parent
6cb9f550f7
commit
6d141ca131
38
.github/workflows/deploy_to_gcp.yml
vendored
Normal file
38
.github/workflows/deploy_to_gcp.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
name: Gitea Deploy to GCP
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- deploy-prd
|
||||||
|
- deploy-dev
|
||||||
|
paths:
|
||||||
|
- 'src/**'
|
||||||
|
- 'terraform/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
name: Deploy to GCP
|
||||||
|
runs-on: gcloud-tf
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Check Deploy Tools
|
||||||
|
run: |
|
||||||
|
gcloud --version
|
||||||
|
terraform --version
|
||||||
|
|
||||||
|
|
||||||
|
# - name: Set up Cloud SDK
|
||||||
|
# uses: google-github-actions/setup-gcloud@v1
|
||||||
|
# with:
|
||||||
|
# project_id: ${{ secrets.GCP_PROJECT_ID }}
|
||||||
|
# service_account_key: ${{ secrets.GCP_SA_KEY }}
|
||||||
|
# export_default_credentials: true
|
||||||
|
|
||||||
|
# - name: Run deployment script
|
||||||
|
# run: |
|
||||||
|
# chmod +x ./deploy.sh
|
||||||
|
# ./deploy.sh
|
||||||
7
.gitignore
vendored
7
.gitignore
vendored
@ -172,3 +172,10 @@ cython_debug/
|
|||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
|
# terraform.tfstate files
|
||||||
|
_*.tfvars
|
||||||
|
.terraform/
|
||||||
|
.terraform.lock.hcl
|
||||||
|
*.tfstate
|
||||||
|
*.tfstate.backup
|
||||||
|
*deploy.env
|
||||||
19
scripts/deploy/init_terraform.sh
Normal file
19
scripts/deploy/init_terraform.sh
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Safe mode(when error,kill script)
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
TF_DIR=${TF_DIR:-terraform}
|
||||||
|
|
||||||
|
# GCS S3などで保存する
|
||||||
|
TF_STATE_BUCKET=${TF_STATE_BUCKET:-cicd-tfstate-bucket}
|
||||||
|
ENV=${ENV:-dev}
|
||||||
|
REPO_NAME=${REPO_NAME:-unknown}
|
||||||
|
|
||||||
|
cd "$TF_DIR"
|
||||||
|
|
||||||
|
# --- terraform init 実行 ---
|
||||||
|
terraform init \
|
||||||
|
-backend-config="bucket=${TF_STATE_BUCKET}" \
|
||||||
|
-backend-config="prefix=${REPO_NAME}/${ENV}" \
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user