GitHub Secrets Setup Guide
This guide explains how to set up the required GitHub secrets for publishing Terraphim crates.
Required Secrets
1. OP_SERVICE_ACCOUNT_TOKEN
This token allows GitHub Actions to authenticate with 1Password and retrieve the crates.io publishing token.
Setup Steps:
-
Create a 1Password Service Account
- Go to 1Password Business > Integrations > Other > Get a service account token
- Create a new service account with access to the "TerraphimPlatform" vault
- Give it read access to the
crates.io.tokenitem - Copy the generated token
-
Add to GitHub Repository Secrets
- Go to your repository on GitHub
- Navigate to Settings > Secrets and variables > Actions
- Click "New repository secret"
- Name:
OP_SERVICE_ACCOUNT_TOKEN - Value: Paste the service account token from step 1
- Click "Add secret"
Verification:
The service account should have access to:
- Vault: TerraphimPlatform
- Item: crates.io.token
- Field: token
2. (Optional) CARGO_REGISTRY_TOKEN
For manual publishing or local testing, you can also store the crates.io token directly:
- Get the token from 1Password
# First authenticate with 1Password
# Read the token
- Add to GitHub Secrets
- Name:
CARGO_REGISTRY_TOKEN - Value: Paste the crates.io token
- Name:
Local Development Setup
Option 1: Use the setup script
# Make sure 1Password CLI is installed and you're signed in
Option 2: Manual setup
- Authenticate with 1Password
- Export the token
- Add to .env file (optional)
Security Considerations
β Good Practices
- Use service accounts with minimal required permissions
- Rotate tokens regularly
- Audit access logs in 1Password
- Use repository-specific secrets, not organization-wide when possible
β Avoid
- Committing tokens to the repository
- Sharing tokens in plain text
- Using personal tokens for CI/CD
- Giving broader permissions than necessary
Testing the Setup
Test Local Setup
# Test the token works
Test CI/CD Setup
- Push a change to trigger the workflow
- Go to Actions > Publish Rust Crates
- Run the workflow manually with
dry_run: true - Check that the 1Password authentication succeeds
Troubleshooting
Common Issues
-
"could not read secret" error
- Check 1Password authentication:
op account list - Verify the secret path:
op://TerraphimPlatform/crates.io.token/token - Ensure service account has proper permissions
- Check 1Password authentication:
-
"no token found" error in CI
- Verify GitHub secret is correctly named:
OP_SERVICE_ACCOUNT_TOKEN - Check that the secret is added to the correct repository/environment
- Ensure the service account has access to the vault
- Verify GitHub secret is correctly named:
-
Permission denied when publishing
- Verify the crates.io token has publishing permissions
- Check if the package name conflicts with existing published packages
- Ensure the token hasn't expired
Debug Commands
# Check 1Password status
# Test secret access
# Test cargo token
Workflow Usage
Once set up, you can use the publishing workflow in several ways:
Manual Publishing (Dry Run)
Manual Publishing (Live)
Publish Specific Crate
Tag-based Publishing
Create and push a tag to automatically trigger publishing: