break up wr build #250
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GH Release and NPM Publish | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'next' | |
paths: | |
- 'libraries/**' | |
- 'internal/**' | |
- 'scripts/**' | |
- 'package.json' | |
- '.github/workflows/publish-package.yml' | |
- 'apps/gui/**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Install | |
run: pnpm install --frozen-lockfile | |
- name: Build Worker Relay | |
run: | | |
pnpm --filter @nostrwatch/worker-relay run clean | |
pnpm --filter @nostrwatch/worker-relay run tsc | |
pnpm --filter @nostrwatch/worker-relay run copy:wasm | |
pnpm --filter @nostrwatch/worker-relay run build:esm | |
- name: Build GUI | |
run: pnpm --filter @nostrwatch/gui | |
- name: Check Artifact Size | |
run: du -sh libraries/**/dist internal/**/dist apps/gui/dist | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: built-packages | |
path: | | |
libraries/**/dist/ | |
libraries/**/src/sqlite/sqlite3.wasm | |
libraries/**/package.json | |
internal/**/dist/ | |
internal/**/package.json | |
apps/gui/dist/ | |
apps/gui/package.json | |
publish: | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- package: 'nostrings' | |
- package: 'announce' | |
- package: 'logger' | |
- package: 'seed' | |
- package: 'utils' | |
- package: 'nwcache' | |
- package: 'controlflow' | |
- package: 'publisher' | |
- package: 'nocap' | |
- package: 'nocap-websocket-adapter-default' | |
- package: 'nocap-websocket-browser-adapter-default' | |
- package: 'nocap-info-adapter-default' | |
- package: 'nocap-dns-adapter-default' | |
- package: 'nocap-geo-adapter-default' | |
- package: 'nocap-ssl-adapter-default' | |
- package: 'nocap-every-adapter-default' | |
- package: 'worker-relay' | |
- package: 'gui' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Download Build Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: built-packages | |
path: . | |
- name: Install Dependencies | |
run: pnpm install --frozen-lockfile --ignore-scripts | |
- name: Find Package | |
id: find_package | |
run: | | |
PKG_PATH=$(find libraries internal apps -type d -name "${{ matrix.package }}" -print -quit) | |
echo "the_path=$PKG_PATH" >> "$GITHUB_OUTPUT" | |
- name: Publish Package | |
id: publish | |
if: matrix.package != 'gui' | |
uses: JS-DevTools/npm-publish@v3 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
package: ${{ steps.find_package.outputs.the_path }}/package.json | |
strategy: all | |
access: public | |
- name: Set Meta | |
id: meta | |
run: | | |
RELEASE_SLUG="${{ matrix.package }}@v${{ steps.publish.outputs.version }}" | |
echo "release_slug=$RELEASE_SLUG" >> "$GITHUB_OUTPUT" | |
- name: Archive Subdirectory | |
id: archive | |
run: | | |
zip -r "${{ steps.meta.outputs.release_slug }}.zip" "${{ steps.find_package.outputs.the_path }}" | |
- name: Create Release ${{ steps.meta.outputs.release_slug }} | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.meta.outputs.release_slug }} | |
release_name: ${{ steps.meta.outputs.release_slug }} | |
body: "" | |
draft: false | |
prerelease: true | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./${{ steps.meta.outputs.release_slug }}.zip | |
asset_name: ${{ steps.meta.outputs.release_slug }}.zip | |
asset_content_type: application/zip |