Build Dev Image #38
This file contains hidden or 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
| # Daily image build workflow | |
| # Builds a new base image with the latest code at 03:00 HKT daily | |
| name: Build Dev Image | |
| on: | |
| schedule: | |
| # 03:00 HKT = 19:00 UTC (previous day) | |
| - cron: '0 19 * * *' | |
| workflow_dispatch: | |
| # Allow manual trigger from GitHub UI | |
| env: | |
| GCP_PROJECT_ID: teable-666 | |
| GCP_ZONE: asia-southeast1-a | |
| IMAGE_FAMILY: teable-dev | |
| jobs: | |
| build-image: | |
| name: Build Teable Dev Image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Authenticate to Google Cloud | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} | |
| - name: Set up Cloud SDK | |
| uses: google-github-actions/setup-gcloud@v2 | |
| - name: Configure SSH for GCP | |
| run: | | |
| # Create SSH directory | |
| mkdir -p ~/.ssh | |
| chmod 700 ~/.ssh | |
| # Generate SSH key for gcloud compute ssh | |
| ssh-keygen -t ed25519 -f ~/.ssh/google_compute_engine -N "" -C "github-actions@build" | |
| chmod 600 ~/.ssh/google_compute_engine | |
| # Configure SSH to skip host key checking for GCP instances | |
| cat >> ~/.ssh/config << 'EOF' | |
| Host * | |
| StrictHostKeyChecking no | |
| UserKnownHostsFile /dev/null | |
| LogLevel ERROR | |
| EOF | |
| chmod 600 ~/.ssh/config | |
| # Add SSH key to OS Login (so gcloud compute ssh can use it) | |
| gcloud compute os-login ssh-keys add --key-file=~/.ssh/google_compute_engine.pub --project=${{ env.GCP_PROJECT_ID }} || true | |
| - name: Build Image | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.TEABLE_EE_TOKEN }} | |
| run: | | |
| cd infra/image-builder | |
| chmod +x build-image.sh | |
| ./build-image.sh | |
| - name: Notify on failure | |
| if: failure() | |
| run: | | |
| echo "::error::Image build failed! Check the logs for details." | |