Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 31 additions & 5 deletions .github/workflows/publish-libraries-on-merge.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish packages to npm
name: Publish packages to GitHub Packages

on:
pull_request:
Expand All @@ -9,7 +9,7 @@ on:

permissions:
contents: write
id-token: write
packages: write

concurrency:
group: publish-libraries
Expand Down Expand Up @@ -98,10 +98,36 @@ jobs:
- name: Build libraries
run: ./bin/yarn nx run-many -t build --projects=tag:type:lib

- name: Publish to npm
- name: Configure Node.js for GitHub Packages publishing
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
with:
node-version-file: '.nvmrc'
registry-url: 'https://npm.pkg.github.com'
scope: '@wireapp'

- name: Verify external runtime dependencies on GitHub Packages
shell: bash
run: |
set -euo pipefail

PROTOCOL_MESSAGING_VERSION="$(
node -p "require('./libraries/api-client/package.json').dependencies['@wireapp/protocol-messaging']"
)"

if ! npm view \
"@wireapp/protocol-messaging@${PROTOCOL_MESSAGING_VERSION}" \
version \
--registry=https://npm.pkg.github.com; then
echo "::error::@wireapp/protocol-messaging@${PROTOCOL_MESSAGING_VERSION} is not available from GitHub Packages or this workflow does not have read access."
exit 1
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to GitHub Packages
run: |
echo "📦 Publishing release to npm..."
echo "📦 Publishing release to GitHub Packages..."
./bin/yarn nx release publish --verbose
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true
255 changes: 107 additions & 148 deletions docs/library-publishing.md

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions libraries/api-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,21 @@ yarn start

### Installation

`@wireapp/api-client` is published to GitHub Packages. Configure the `@wireapp` scope in an untracked `.yarnrc.yml`, then install with Yarn:

```yaml
npmScopes:
wireapp:
npmRegistryServer: "https://npm.pkg.github.com"
npmAuthToken: "${GITHUB_PACKAGES_TOKEN}"
```

```bash
yarn add @wireapp/api-client
```

Set `GITHUB_PACKAGES_TOKEN` to a GitHub personal access token (classic) with `read:packages`; the account needs read access to the package. Installation also requires `@wireapp/protocol-messaging` to be available from GitHub Packages; publication is blocked until that cross-repository prerequisite is met.

### Usage

#### Wire Backend
Expand Down
3 changes: 3 additions & 0 deletions libraries/api-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"url": "https://github.com/wireapp/wire-webapp",
"directory": "libraries/api-client"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com"
},
"files": [
"lib"
],
Expand Down
6 changes: 4 additions & 2 deletions libraries/commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"url": "https://github.com/wireapp/wire-webapp",
"directory": "libraries/commons"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com"
},
"files": [
"lib"
],
Expand Down Expand Up @@ -41,6 +44,5 @@
"test:coverage": "nx run commons-lib:test:coverage",
"test:watch": "nx run commons-lib:test --watch"
},
"version": "5.4.13",
"private": true
"version": "5.4.13"
}
7 changes: 6 additions & 1 deletion libraries/commons/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@
"options": {
"command": "tsc --project {projectRoot}/tsconfig.json --noEmit"
}
},
"nx-release-publish": {
"executor": "@nx/js:release-publish",
"dependsOn": ["^nx-release-publish"],
"options": {}
}
},
"tags": ["type:lib", "scope:commons"]
"tags": ["type:lib", "scope:commons", "npm:public"]
}
6 changes: 4 additions & 2 deletions libraries/priority-queue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"url": "https://github.com/wireapp/wire-webapp",
"directory": "libraries/priority-queue"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com"
},
"files": [
"lib"
],
Expand All @@ -33,6 +36,5 @@
"test:coverage": "nx run priority-queue-lib:test:coverage",
"test:watch": "nx run priority-queue-lib:test --watch"
},
"version": "2.1.19",
"private": true
"version": "2.1.19"
}
7 changes: 6 additions & 1 deletion libraries/priority-queue/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@
"options": {
"command": "tsc --project {projectRoot}/tsconfig.json --noEmit"
}
},
"nx-release-publish": {
"executor": "@nx/js:release-publish",
"dependsOn": ["^nx-release-publish"],
"options": {}
}
},
"tags": ["type:lib", "scope:priority-queue"]
"tags": ["type:lib", "scope:priority-queue", "npm:public"]
}
Loading