Skip to content

Add workflow to build and upload client #1

Add workflow to build and upload client

Add workflow to build and upload client #1

Workflow file for this run

name: Build client
on:
push:
branches:
- main
jobs:
build_client:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- id: "auth"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GCP_SA_KEY }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v1"
# Build the Docker image first
- name: Build the Docker image
run: docker build -f web-client/Dockerfile.builder -t web_client_builder .
# Run the Docker container to build the web-client
- name: Build web-client
run: docker run --rm -v $(pwd):/track -w /track web_client_builder sh -c "trunk build web-client/index.html"
- name: Build static files and upload
run: |
ls -l web-client/dist
tar -czvf web-client.tar.gz web-client/dist
# Add git sha to archive name
mv web-client.tar.gz web-client-${GITHUB_SHA:0:7}.tar.gz
- name: Upload to GCS
uses: google-github-actions/upload-cloud-storage@v1
with:
path: web-client.tar.gz
destination: ocho-osai/track/web-client.tar.gz
- name: Build web-client
run: |
echo "File in bucket:"
gsutil ls gs://ocho-osai/track/web-client-${GITHUB_SHA:0:7}.tar.gz