Skip to content

Commit 026687b

Browse files
committed
use circleci context
1 parent c985021 commit 026687b

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

.circleci/config.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ jobs:
9898
<<: *go_image
9999
steps:
100100
- checkout
101-
- add_ssh_keys:
102-
fingerprints:
103-
- "SHA256:w5lYpE8DMWxUdasN8yMbbFdiz6s50PPBJMkV0a1iyZ8"
104101
- attach_workspace:
105102
at: /tmp/workspace
106103
- run:
@@ -121,7 +118,9 @@ jobs:
121118
122119
echo "Creating tag: $NEW_TAG"
123120
git tag -a "$NEW_TAG" -m "Release $NEW_TAG"
124-
git push origin "$NEW_TAG"
121+
122+
# Push using HTTPS with GitHub token (no fingerprint needed)
123+
git push https://${GH_TOKEN}@github.com/snyk/cli-extension-dep-graph.git "$NEW_TAG"
125124
126125
# Filters for branches
127126
filters_pr_only: &filters_pr_only
@@ -174,6 +173,8 @@ workflows:
174173
<<: *filters_main_only
175174

176175
- tag-release:
176+
context:
177+
- os-ecosystems
177178
requires:
178179
- determine-version
179180
<<: *filters_main_only

docs/RELEASE.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,26 @@ ls -la ./dist/
105105

106106
## CircleCI Configuration
107107

108-
### Required SSH Key
108+
### Required Context Variable
109109

110-
The CircleCI project must have an SSH key configured for pushing tags to GitHub:
110+
The CircleCI `os-ecosystems` context must contain:
111111

112-
1. Go to CircleCI → Project Settings → SSH Keys
113-
2. Add a new SSH key with write access to the repository
114-
3. The fingerprint is already configured in `.circleci/config.yml`:
115-
- `SHA256:w5lYpE8DMWxUdasN8yMbbFdiz6s50PPBJMkV0a1iyZ8`
112+
- **`GH_TOKEN`**: GitHub Personal Access Token or GitHub App token with `repo` permissions for pushing tags
116113

117-
**Note:** The SSH key must have push permissions to the `snyk/cli-extension-dep-graph` repository.
114+
### Context Setup
115+
116+
1. Go to CircleCI → Organization Settings → Contexts
117+
2. Use existing context: `os-ecosystems`
118+
3. Ensure the context has the environment variable:
119+
- **Name:** `GH_TOKEN`
120+
- **Value:** GitHub token with `repo` scope
121+
- Create token at: https://github.com/settings/tokens (if needed)
122+
123+
**Benefits:**
124+
- ✅ No SSH key fingerprints to manage
125+
- ✅ Easy to rotate - just update the context variable
126+
- ✅ No risk of broken fingerprints after key rotation
127+
- ✅ Works immediately without SSH key setup
118128

119129
## Release Artifacts
120130

@@ -152,10 +162,11 @@ Each release includes:
152162
**Problem**: Tag creation fails with permission denied or authentication error.
153163

154164
**Solutions**:
155-
- Verify SSH key is configured in CircleCI project settings
156-
- Ensure the fingerprint in `.circleci/config.yml` matches the key in CircleCI
157-
- Check that the SSH key has push permissions to the repository
158-
- Verify the SSH key hasn't been revoked or removed from GitHub
165+
- Verify `GH_TOKEN` is set in the CircleCI context: `os-ecosystems`
166+
- Ensure the token has `repo` scope permissions
167+
- Check that the token hasn't expired
168+
- Verify the token is from a user/app with push permissions to the repository
169+
- Test the token manually: `curl -H "Authorization: token $GH_TOKEN" https://api.github.com/user`
159170

160171
### Tag already exists
161172

0 commit comments

Comments
 (0)