Skip to content

patch service worker deregister, and page header html parse #422

patch service worker deregister, and page header html parse

patch service worker deregister, and page header html parse #422

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 Packages
run: pnpm -r build
# - 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 build
- 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
environment: ${{ matrix.package == 'gui' && 'next.nostr.watch' || 'default' }}
strategy:
fail-fast: false
matrix:
include:
- package: 'nostrings'
- 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: 'route66'
- package: 'route66/adapters/cache/NostrSqliteAdapter'
- package: 'route66/adapters/websocket/NostrToolsAdapter'
- package: 'memory-relay'
- package: 'gui'
- package: 'schemata'
- package: 'schemata-js-ajv'
- package: 'auditor'
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: Deploy to Bunny
if: matrix.package == 'gui'
uses: R-J-dev/[email protected]
with:
access-key: ${{ secrets.BUNNY_API_KEY }}
directory-to-upload: "./apps/gui/dist"
storage-endpoint: "https://sg.storage.bunnycdn.com"
storage-zone-name: "nostr-watch"
storage-zone-password: ${{ secrets.BUNNY_STORAGE_ZONE_PASSWORD }}
concurrency: "50"
enable-delete-action: true
enable-purge-pull-zone: true
pull-zone-id: "3313140"
replication-timeout: "15000"
# - name: Install jq
# if: matrix.package == 'gui'
# run: sudo apt-get update && sudo apt-get install -y jq
# - name: Get package version (GUI)
# if: matrix.package == 'gui'
# id: get_version
# run: |
# VERSION=$(jq -r '.version' ./apps/gui/package.json)
# echo "VERSION=${VERSION}" >> $GITHUB_ENV
# - name: Prepare SSH Key
# if: matrix.package == 'gui'
# run: |
# mkdir -p ~/.ssh
# echo "${{ secrets.GUI_SSH_KEY }}" > ~/.ssh/gui_ssh_key
# chmod 600 ~/.ssh/gui_ssh_key
# - name: Validate Secrets
# if: matrix.package == 'gui'
# run: |
# if [ -z "${{ secrets.GUI_HOST_USER }}" ] || [ -z "${{ secrets.GUI_HOST_IP }}" ]; then
# echo "Secrets GUI_HOST_USER or GUI_HOST_IP are missing."
# exit 1
# else
# echo "Secrets are set correctly."
# fi
# - name: Debug Command Construction
# if: matrix.package == 'gui'
# run: |
# echo ssh -i ~/.ssh/gui_ssh_key -o StrictHostKeyChecking=no "${{ secrets.GUI_HOST_USER }}@${{ secrets.GUI_HOST_IP }}" echo "Connection Successful"
# - name: Debug SSH Command
# if: matrix.package == 'gui'
# run: |
# echo "Testing SSH Connection..."
# echo "Host User: ${{ secrets.GUI_HOST_USER }}"
# echo "Host IP: ${{ secrets.GUI_HOST_IP }}"
# ssh -v -i ~/.ssh/gui_ssh_key -o StrictHostKeyChecking=no "${{ secrets.GUI_HOST_USER }}@${{ secrets.GUI_HOST_IP }}" echo "Connection Successful"
# - name: Prepare Directories (GUI)
# if: matrix.package == 'gui'
# run: |
# VERSION=${{ env.VERSION }}
# echo "Deploying version $VERSION"
# ssh -v -i ~/.ssh/gui_ssh_key -o StrictHostKeyChecking=no ${{ secrets.GUI_HOST_USER }}@${{ secrets.GUI_HOST_IP }} << EOF
# set -e
# mkdir -p /var/www/${VERSION}
# EOF
# - name: Upload Build (GUI)
# if: matrix.package == 'gui'
# run: |
# scp -i ~/.ssh/gui_ssh_key -o StrictHostKeyChecking=no -r ./apps/gui/dist/* ${{ secrets.GUI_HOST_USER }}@${{ secrets.GUI_HOST_IP }}:/var/www/${{ env.VERSION }}/
# - name: Update Symlink & Permissions
# if: matrix.package == 'gui'
# run: |
# ssh -v -i ~/.ssh/gui_ssh_key -o StrictHostKeyChecking=no ${{ secrets.GUI_HOST_USER }}@${{ secrets.GUI_HOST_IP }} << EOF
# set -e
# ln -sfn /var/www/${{ env.VERSION }} /var/www/html
# chown -R caddy:www-data /var/www/html
# chown -R caddy:www-data /var/www/${{ env.VERSION }}
# EOF
# - name: Cleanup SSH Key
# if: matrix.package == 'gui'
# run: |
# rm -f ~/.ssh/gui_ssh_key
- 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
if: matrix.package != 'gui'
id: meta
run: |
RELEASE_SLUG="${{ matrix.package }}@v${{ steps.publish.outputs.version }}"
echo "release_slug=$RELEASE_SLUG" >> "$GITHUB_OUTPUT"
- name: Debug Directory Before Zipping
if: matrix.package != 'gui'
run: |
echo "Checking contents of: ${{ steps.find_package.outputs.the_path }}"
ls -l "${{ steps.find_package.outputs.the_path }}"
- name: Archive Subdirectory
if: matrix.package != 'gui'
id: archive
run: |
if [ -d "${{ steps.find_package.outputs.the_path }}" ]; then
cd "$(dirname "${{ steps.find_package.outputs.the_path }}")"
zip -r "${{ matrix.package }}@v${{ steps.publish.outputs.version }}.zip" "$(basename "${{ steps.find_package.outputs.the_path }}")"/*
else
echo "Directory not found: ${{ steps.find_package.outputs.the_path }}"
exit 1
fi
- name: Create Release ${{ steps.meta.outputs.release_slug }}
if: matrix.package != 'gui'
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
if: matrix.package != 'gui'
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