feat: deployment #11
Workflow file for this run
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: Build & Deploy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Authenticate with Google Cloud | |
uses: google-github-actions/auth@v2 | |
#if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
with: | |
workload_identity_provider: projects/695814629538/locations/global/workloadIdentityPools/github/providers/github-actions-provider | |
service_account: [email protected] | |
token_format: access_token | |
- name: Set up GCloud SDK | |
#if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: google-github-actions/setup-gcloud@v2 | |
- name: Use Node.js 22.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22.x | |
- name: Get npm cache directory | |
id: npm-cache-dir | |
shell: bash | |
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.npm-cache-dir.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Deploy to Google Cloud Bucket | |
uses: google-github-actions/upload-cloud-storage@v2 | |
#if: success() && github.ref == 'refs/heads/main' && env.backup_done == 'true' | |
with: | |
path: dist/ | |
destination: intact-frontend | |
parent: false |