Skip to content

(ci/cd) GCS deployment #5

(ci/cd) GCS deployment

(ci/cd) GCS deployment #5

Workflow file for this run

name: Deploy to GCS
on:
push:
branches:
- main # Trigger on push to main branch
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18" # Ensure the correct Node.js version
- name: Install dependencies
working-directory: travian/frontend # Change to frontend directory
run: npm install
- name: Build project
working-directory: travian/frontend # Change to frontend directory
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: "voltaic-sensor-438416-h9"
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