|
| 1 | +# Release Process |
| 2 | + |
| 3 | +This document describes the release process for DedPaste, including our implementation of GitHub's Immutable Releases feature for enhanced supply chain security. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +DedPaste uses an automated release workflow that creates immutable, cryptographically attested releases. This ensures that all release artifacts are tamper-proof and verifiable. |
| 8 | + |
| 9 | +## Automated Release Workflow |
| 10 | + |
| 11 | +### Version Bumping |
| 12 | + |
| 13 | +When a pull request is merged to the `main` branch: |
| 14 | + |
| 15 | +1. **Auto Version Bump** workflow analyzes the PR: |
| 16 | + - Checks PR labels (`major`, `minor`, `patch`) |
| 17 | + - Analyzes commit messages for conventional commit patterns |
| 18 | + - Determines the appropriate version bump |
| 19 | + |
| 20 | +2. Conventional commit patterns: |
| 21 | + - `feat:` or `feat(scope):` → Minor version bump |
| 22 | + - `fix:` or `fix(scope):` → Patch version bump |
| 23 | + - `BREAKING CHANGE:` or `feat!:` → Major version bump |
| 24 | + |
| 25 | +3. Updates `package.json` with the new version |
| 26 | +4. Triggers the release workflow |
| 27 | + |
| 28 | +### Release Creation |
| 29 | + |
| 30 | +The **Release with SBOM and Notes** workflow: |
| 31 | + |
| 32 | +1. **Builds the project** |
| 33 | + - Compiles TypeScript files |
| 34 | + - Runs tests |
| 35 | + - Generates build artifacts |
| 36 | + |
| 37 | +2. **Generates SBOM** |
| 38 | + - Creates a Software Bill of Materials (SBOM) in CycloneDX format |
| 39 | + - Documents all dependencies and their versions |
| 40 | + |
| 41 | +3. **Creates release notes** |
| 42 | + - Lists all commits since the last release |
| 43 | + - Links to relevant pull requests |
| 44 | + - Includes SBOM information |
| 45 | + - Adds verification instructions |
| 46 | + |
| 47 | +4. **Publishes the release** |
| 48 | + - Creates a GitHub release with the tag `vX.Y.Z` |
| 49 | + - Attaches the SBOM file |
| 50 | + - Includes detailed release notes |
| 51 | + |
| 52 | +5. **Generates build provenance attestations** 🔐 |
| 53 | + - Creates cryptographic attestations for all release artifacts |
| 54 | + - Signs attestations using GitHub's Sigstore integration |
| 55 | + - Ensures artifacts are immutable and verifiable |
| 56 | + |
| 57 | +6. **Publishes to NPM** |
| 58 | + - Publishes the package with provenance |
| 59 | + - Uses OIDC Trusted Publishers for secure authentication |
| 60 | + |
| 61 | +## Immutable Releases 🔐 |
| 62 | + |
| 63 | +### What are Immutable Releases? |
| 64 | + |
| 65 | +Immutable releases are a security feature that makes release artifacts tamper-proof: |
| 66 | + |
| 67 | +- **Immutable assets**: Once published, release artifacts cannot be modified, added, or deleted |
| 68 | +- **Protected tags**: Git tags are locked to specific commits and cannot be moved |
| 69 | +- **Cryptographic attestations**: Each release includes signed build provenance attestations |
| 70 | +- **Verifiable provenance**: Anyone can verify that artifacts were built by the official workflow |
| 71 | + |
| 72 | +### How We Implement It |
| 73 | + |
| 74 | +Our release workflow automatically: |
| 75 | + |
| 76 | +1. **Generates build provenance attestations** for: |
| 77 | + - SBOM file (`bom.json`) |
| 78 | + - Build artifacts (`dist/*`) |
| 79 | + |
| 80 | +2. **Signs attestations** using GitHub's Sigstore integration |
| 81 | + - Uses the GitHub Actions OIDC token |
| 82 | + - Creates tamper-evident signatures |
| 83 | + - Links artifacts to specific workflow runs and commits |
| 84 | + |
| 85 | +3. **Publishes releases with attestations** |
| 86 | + - Release immutability is enabled in this repository (Settings → Code and automation → Releases) |
| 87 | + - All releases are immutable: artifacts cannot be modified after publication |
| 88 | + - Tags cannot be moved or deleted |
| 89 | + |
| 90 | +### Verifying Releases |
| 91 | + |
| 92 | +Anyone can verify the authenticity and integrity of our releases using the GitHub CLI: |
| 93 | + |
| 94 | +```bash |
| 95 | +# Install GitHub CLI if needed |
| 96 | +# See: https://cli.github.com/ |
| 97 | + |
| 98 | +# Verify the SBOM file |
| 99 | +gh attestation verify bom.json --owner anoncam --repo dedpaste |
| 100 | + |
| 101 | +# Verify build artifacts |
| 102 | +gh attestation verify <artifact-path> --owner anoncam --repo dedpaste |
| 103 | + |
| 104 | +# Download and verify a release artifact |
| 105 | +gh release download v1.24.0 --pattern "bom.json" --repo anoncam/dedpaste |
| 106 | +gh attestation verify bom.json --owner anoncam --repo dedpaste |
| 107 | +``` |
| 108 | + |
| 109 | +Verification confirms: |
| 110 | +- ✅ Artifact was built by the official GitHub Actions workflow |
| 111 | +- ✅ Artifact has not been tampered with since publication |
| 112 | +- ✅ Artifact is linked to specific commits and workflow runs |
| 113 | +- ✅ Build process is traceable and transparent |
| 114 | + |
| 115 | +### Benefits |
| 116 | + |
| 117 | +1. **Supply Chain Security** |
| 118 | + - Prevents tampering with release artifacts |
| 119 | + - Protects against malicious code injection |
| 120 | + - Ensures artifacts match the source code |
| 121 | + |
| 122 | +2. **Transparency** |
| 123 | + - Complete build provenance tracking |
| 124 | + - Verifiable connection between code and artifacts |
| 125 | + - Audit trail for all releases |
| 126 | + |
| 127 | +3. **Trust** |
| 128 | + - Users can verify authenticity of downloads |
| 129 | + - Cryptographic proof of origin |
| 130 | + - Compliance with security best practices |
| 131 | + |
| 132 | +## Manual Release Process |
| 133 | + |
| 134 | +If needed, maintainers can trigger a release manually: |
| 135 | + |
| 136 | +1. Go to the [Actions tab](https://github.com/anoncam/dedpaste/actions) |
| 137 | +2. Select "Release with SBOM and Notes" workflow |
| 138 | +3. Click "Run workflow" |
| 139 | +4. Optionally specify a version to force release |
| 140 | + |
| 141 | +## Troubleshooting |
| 142 | + |
| 143 | +### Release Already Exists |
| 144 | + |
| 145 | +If a release already exists for a version, the workflow will skip creating a duplicate. Check: |
| 146 | +- Existing releases: https://github.com/anoncam/dedpaste/releases |
| 147 | +- Workflow logs in the Actions tab |
| 148 | + |
| 149 | +### Build Attestation Failures |
| 150 | + |
| 151 | +If attestation generation fails: |
| 152 | +- Check that `id-token: write` and `attestations: write` permissions are set |
| 153 | +- Verify the workflow is running on a public repository |
| 154 | +- Check GitHub Actions logs for detailed error messages |
| 155 | + |
| 156 | +### NPM Publish Failures |
| 157 | + |
| 158 | +If NPM publishing fails: |
| 159 | +- Verify the version doesn't already exist on NPM |
| 160 | +- Check that OIDC Trusted Publishers are configured correctly |
| 161 | +- Review npm provenance documentation |
| 162 | + |
| 163 | +## Security Considerations |
| 164 | + |
| 165 | +- **Never manually modify releases**: All releases should be created by the automated workflow |
| 166 | +- **Verify downloads**: Always verify release artifacts using `gh attestation verify` |
| 167 | +- **Report issues**: If you find any security concerns, please report them responsibly |
| 168 | + |
| 169 | +## Additional Resources |
| 170 | + |
| 171 | +- [GitHub Immutable Releases Documentation](https://docs.github.com/en/repositories/releasing-projects-on-github/creating-releases/immutable-releases) |
| 172 | +- [GitHub Actions Artifact Attestation](https://docs.github.com/en/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds) |
| 173 | +- [Sigstore Documentation](https://docs.sigstore.dev/) |
| 174 | +- [SLSA Framework](https://slsa.dev/) |
0 commit comments