Skip to content

(iac) retrive gcp project id on my cicd #11

(iac) retrive gcp project id on my cicd

(iac) retrive gcp project id on my cicd #11

Workflow file for this run

name: Deploy to GCS
on:
push:
branches:
- dev
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.5.3 # Specify the version you are using
- name: Initialize Terraform
working-directory: iac
run: terraform init
- name: Apply Terraform
working-directory: iac
id: terraform

Check failure on line 27 in .github/workflows/deploy.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/deploy.yml

Invalid workflow file

You have an error in your yaml syntax on line 27
run: terraform apply -auto-approve \
-var="region=${{ secrets.GCP_REGION }}" \
-var="bucket_name=${{ secrets.GCP_BUCKET_NAME }}" \
-var="service_account_id=${{ secrets.GCP_SERVICE_ACCOUNT_ID }}" \
-var="billing_account_id=${{ secrets.GCP_BILLING_ACCOUNT_ID }}"
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GCP_SA_KEY }}
- name: Get project ID from Terraform output
working-directory: iac
id: get_gcp_project_id
run: echo "PROJECT_ID=$(terraform output -raw gcp_project_id)" >> $GITHUB_ENV
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18"
- name: Install dependencies
working-directory: travian/frontend
run: npm install
- name: Build project
working-directory: travian/frontend
run: npm run build
- name: Authenticate to GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ env.PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
- name: Upload to GCS
run: |
gsutil -m rsync -r travian/frontend/dist gs://peillac.xyz
- name: Make GCS objects public
run: gsutil iam ch allUsers:objectViewer gs://peillac.xyz