4.5 KiB
Crystal Release Instructions
This document outlines the process for releasing new versions of Crystal for macOS with automatic updates.
Prerequisites
Configure these secrets in your GitHub repository (Settings → Secrets and variables → Actions):
Required for macOS Signing & Notarization:
APPLE_CERTIFICATE: Base64-encoded .p12 certificateAPPLE_CERTIFICATE_PASSWORD: Certificate passwordAPPLE_ID: Apple Developer account emailAPPLE_APP_PASSWORD: App-specific password for notarizationAPPLE_TEAM_ID: Apple Developer Team ID
To encode your certificate for GitHub secrets:
base64 -i certificate.p12 -o certificate_base64.txt
Copy the contents of the base64 file to the GitHub secret.
Note: The GITHUB_TOKEN is automatically provided by GitHub Actions.
Release Process
1. Prepare the Release
# Ensure you're on the main branch
git checkout main
git pull origin main
# Run tests and ensure everything passes
pnpm test
pnpm typecheck
2. Update Version
Edit package.json and update the version number:
{
"version": "0.1.2" // Update this
}
3. Update Changelog
Create or update CHANGELOG.md with release notes:
## v0.1.2 - 2024-06-14
### Added
- Feature X
- Feature Y
### Fixed
- Bug A
- Bug B
### Changed
- Improvement C
4. Commit Version Changes
git add package.json CHANGELOG.md
git commit -m "chore: bump version to 0.1.2"
git push origin main
5. Create and Push Git Tag
git tag v0.1.2
git push origin v0.1.2
6. Automated Release
Once you push the tag, GitHub Actions will automatically:
- Build the macOS application
- Sign and notarize the app (if certificates are configured)
- Generate auto-update metadata files (
latest-mac.yml) - Create a GitHub release with the .dmg file
No manual action needed - just wait for the workflow to complete.
7. Verify Release
- Go to https://github.com/stravu/crystal/releases
- Verify the new release is created with:
- Proper version tag
- Release notes from the commit history
- macOS .dmg file
- Auto-update metadata file (
latest-mac.yml)
Auto-Update Files
The build process automatically generates these files required for auto-updates:
- latest-mac.yml - macOS update metadata
- Crystal-[version]-mac.zip - macOS update package
- Crystal-[version].dmg - macOS installer
Build Configuration
The release configuration is defined in package.json:
{
"build": {
"appId": "com.stravu.crystal",
"productName": "Crystal",
"mac": {
"category": "public.app-category.developer-tools",
"hardenedRuntime": true,
"gatekeeperAssess": false,
"notarize": true
},
"publish": {
"provider": "github",
"owner": "stravu",
"repo": "crystal"
}
}
}
Troubleshooting
Auto-update not working
- Missing update files: Ensure the GitHub Actions workflow completed successfully
- Certificate issues: Check that all Apple certificates are properly configured in GitHub secrets
- Notarization fails: Verify Apple credentials are correct and the app-specific password is valid
Build fails
- Native dependencies: The workflow runs
pnpm electron:rebuildautomatically - Certificate not found: Ensure the certificate is properly base64 encoded
- Version conflicts: Make sure the version in package.json matches the git tag
Testing Updates
To test auto-updates:
- Install an older version of Crystal
- Crystal will automatically check for updates on startup
- When an update is found, the in-app dialog will appear
- Click "Download Update" to test the auto-update process
Best Practices
- Semantic Versioning: Follow semver (MAJOR.MINOR.PATCH)
- Release Notes: Keep CHANGELOG.md updated with user-friendly notes
- Testing: Test the release workflow on a test repository first
- Incremental Updates: Avoid jumping multiple major versions
Emergency Rollback
If a release has critical issues:
- Delete the problematic release and tag from GitHub
- Fix the issue in the code
- Create a new version (e.g., if 0.1.2 was bad, release 0.1.3)
- Follow the normal release process
Additional Notes
- Auto-updates only work for signed and notarized applications
- Development builds cannot auto-update
- Users can always manually download from GitHub releases if auto-update fails
- Settings and data are preserved during updates
- Crystal checks for updates on startup and every 24 hours