Merge pull request #36 from Pierre-Alexandre35/dev #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |