Skip to content

Conversation

@takaokouji
Copy link

Summary

This PR adds Google Drive API credentials (Client ID and API Key) as environment variables to the CI/CD workflow, enabling Google Drive integration features in production deployments.

Changes

Modified Files

  • .github/workflows/ci-cd.yml: Added GOOGLE_CLIENT_ID and GOOGLE_API_KEY environment variables to build steps

Environment Variables Added

The following GitHub Secrets are now injected into three build steps:

  1. Run Build (initial production build)

    • Used for all deployment targets
    • Line 66-67
  2. Rebuild for smalruby3-gui GitHub Pages

    • Deployed to https://smalruby.github.io/smalruby3-gui/
    • Line 127-128
  3. Rebuild for branch GitHub Pages

    • Branch-specific preview deployments
    • Line 155-156

Deployment Targets

These environment variables will be available in:

  • smalruby.app - Main production site
  • smalruby.github.io/smalruby3-gui/ - GitHub Pages site
  • Branch deployments - Feature branch previews

Required GitHub Settings

Before merging this PR, the following GitHub Secrets must be configured in the repository:

Steps to Configure

  1. Go to: https://github.com/smalruby/smalruby3-gui/settings/secrets/actions
  2. Click New repository secret
  3. Add the following secrets:

Secret 1: GOOGLE_CLIENT_ID

Name: GOOGLE_CLIENT_ID
Value: [Your OAuth 2.0 Client ID from Google Cloud Console]
Example: 123456789-xxxxxxxx.apps.googleusercontent.com

Secret 2: GOOGLE_API_KEY

Name: GOOGLE_API_KEY
Value: [Your API Key from Google Cloud Console]
Example: AIzaSyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Google Cloud Console Configuration

Ensure the following URLs are added to your Google Cloud Console settings:

OAuth 2.0 Client - Authorized JavaScript origins

  • https://smalruby.app
  • https://smalruby.github.io

API Key - Website restrictions

  • https://smalruby.app/*
  • https://smalruby.github.io/*

See docs/google-drive-setup.md for detailed setup instructions.

Testing

After merging and configuring the secrets:

  1. Deploy to production will include Google API credentials
  2. Test the following features:
    • File menu → "Load from Google Drive"
    • File menu → "Save to Google Drive"
  3. Verify OAuth authentication flow works
  4. Confirm file picker displays correctly

Security Notes

  • ✅ Credentials are stored as GitHub Secrets (encrypted)
  • ✅ OAuth Client ID is restricted to authorized origins
  • ✅ API Key is restricted by HTTP referrer and API scope
  • ✅ No client secret is used (frontend-only implementation)

Related Issues

Documentation


🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

Add GOOGLE_CLIENT_ID and GOOGLE_API_KEY environment variables to all
production build steps in the GitHub Actions workflow. This enables the
Google Drive integration features (file loading and saving) in deployed
environments.

Changes:
- Added environment variables to "Run Build" step (line 66-67)
- Added environment variables to "Rebuild for smalruby3-gui GitHub Pages" step (line 127-128)
- Added environment variables to "Rebuild for branch GitHub Pages" step (line 155-156)

These variables will be sourced from GitHub Secrets and injected into
the webpack build process via webpack.DefinePlugin.

Deployment targets:
- smalruby.app (main production site)
- smalruby.github.io/smalruby3-gui/ (GitHub Pages)
- Branch-specific deployments

Related: #428, #429

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@takaokouji takaokouji merged commit cea4bc1 into develop Dec 14, 2025
2 of 3 checks passed
@takaokouji takaokouji deleted the feature/google-drive-production-env branch December 14, 2025 11:07
github-actions bot pushed a commit that referenced this pull request Dec 14, 2025
…e-drive-production-env

Add Google Drive API credentials to production builds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants