Skip to content

Commit 448e07e

Browse files
committed
wip
1 parent bf86857 commit 448e07e

File tree

4 files changed

+55
-30
lines changed

4 files changed

+55
-30
lines changed

.buildkite/pipeline.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -212,28 +212,6 @@ steps:
212212
key: "v1.1-cache-dev-{{ checksum 'yarn.lock' }}"
213213
paths: ['.yarn/cache/']
214214

215-
# Deploy and NPM publish releases
216-
- label: '[Browser] Publish Packages to NPM :rocket:'
217-
if: |
218-
// Only run when Version Packages PR is merged in
219-
build.message =~ /^Version Packages/ &&
220-
build.branch == "master" &&
221-
build.message !~ /\[skip\]/i
222-
agents:
223-
queue: v1
224-
commands:
225-
- npm config set "//registry.npmjs.org/:_authToken" $${NPM_TOKEN}
226-
- git config --global user.name "buildkite-agent"
227-
- git config --global user.email "[email protected]"
228-
- echo "--- Install dependencies"
229-
- PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 HUSKY=0 yarn install --immutable
230-
- echo "+++ Release packages"
231-
- yarn release
232-
plugins:
233-
- ssh://[email protected]/segmentio/cache-buildkite-plugin#v2.0.0:
234-
key: "v1.1-cache-dev-{{ checksum 'yarn.lock' }}"
235-
paths: ['.yarn/cache/']
236-
237215
- label: 'Snyk :lock:'
238216
agents:
239217
queue: v1
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Check NPM Publish Permissions
2+
3+
on:
4+
workflow_dispatch: # Allows manual triggering
5+
6+
jobs:
7+
check-npm-permissions:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v3
12+
13+
- name: Set up Node.js
14+
uses: actions/setup-node@v3
15+
with:
16+
node-version: 18
17+
registry-url: 'https://registry.npmjs.org/'
18+
19+
- name: Check NPM Authentication
20+
run: |
21+
npm whoami --registry=https://registry.npmjs.org/ || echo "Not authenticated"
22+
23+
- name: Check Publish Access
24+
env:
25+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
26+
PACKAGE_NAME: "@segment/analytics-signals"
27+
run: |
28+
echo "Checking permissions for package: $PACKAGE_NAME"
29+
curl -H "Authorization: Bearer $NPM_TOKEN" \
30+
https://registry.npmjs.org/-/package/$PACKAGE_NAME/access || echo "No access or invalid token"
31+
32+
- name: Dry-Run Publish
33+
env:
34+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
35+
run: |
36+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
37+
npm publish --dry-run || echo "Publish not allowed"

.github/workflows/release-creator.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}
1212

1313
jobs:
1414
release-pr:
15-
name: Create or Update Release PR
15+
name: Create Release Pull Request or Publish to npm
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Checkout Repo
@@ -30,10 +30,12 @@ jobs:
3030
- name: Install Dependencies
3131
run: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 HUSKY=0 yarn install --immutable
3232

33-
- name: Create or Update Release PR
33+
- name: Create Release Pull Request or Publish to npm
3434
id: changesets
3535
uses: changesets/action@v1
3636
with:
3737
version: yarn update-versions-and-changelogs
38+
publish: yarn release
3839
env:
3940
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

RELEASING.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,22 @@ Information is in the [@changesets automation instructions](https://github.com/c
5050
[Check out the @changesets automation instructions](https://github.com/changesets/changesets/blob/main/docs/automating-changesets.md#automating-changesets)
5151

5252
### What does `yarn release` do?
53-
- run prepare scripts
54-
- publish all packages to npm
55-
- pushes tags to repo
56-
- triggers a github release on CI (via tags)
57-
- triggers a CDN release
53+
1. Run prepare scripts
54+
2. Publish all packages to npm
55+
3. Pushes _all_ tags to github (e.g. "@segment/analytics-next@1.7.0", "@segment/analytics-node@1.2.3", etc)
5856

59-
### I don't want to use automation, how do I manually create a release?
57+
### How do I fix the repo if all the packages were published, but the CI Failed to update the [github releases page](https://github.com/segmentio/analytics-next/releases)?
58+
```bash
59+
# checkout master so the HEAD is pointing to the "Version Packages" PR
60+
git co master && git pull --ff-only
6061

62+
# Reads from the current tags and create github releases
63+
export GITHUB_TOKEN="???"
64+
yarn scripts create-release-from-tags
65+
```
66+
67+
68+
### I don't want to use automation, how do I manually create a release?
6169
```bash
6270
export GITHUB_TOKEN="???" ## changelog generator requirement (https://github.com/settings/tokens)
6371

0 commit comments

Comments
 (0)