diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 6647e54..081258c 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -8,226 +8,135 @@ on: types: [created] jobs: - # linux-build: - # runs-on: ubuntu-latest - # env: - # SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 22 - # registry-url: https://registry.npmjs.org/ - # - uses: samuelmeuli/action-snapcraft@v2 - # - run: sudo dpkg --add-architecture i386 && sudo apt-get update -y && sudo apt-get install lzip elfutils libarchive-tools wine wine32 -y - # - run: npm ci - # - run: npm run build-linux - - # windows-build: - # runs-on: windows-latest - # env: - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 22 - # registry-url: https://registry.npmjs.org/ - # - run: npm ci - # - run: npm run build-win - - # macos-build: - # runs-on: macos-latest - # env: - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 22 - # registry-url: https://registry.npmjs.org/ - # - run: npm ci - # - run: npm run build-macos - - # publish-npm: - # runs-on: ubuntu-latest - # env: - # NODE_AUTH_TOKEN: ${{secrets.npm_token}} - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 22 - # registry-url: https://registry.npmjs.org/ - # - uses: samuelmeuli/action-snapcraft@v2 - # - run: npm ci - # - run: npm publish - - - - - - - - - - - - # macos_universal-build: - # runs-on: macos-latest - # env: - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 22 - # registry-url: https://registry.npmjs.org/ - # - run: npm ci - # - run: npm run build-mac_universal - - # mac_zip-build: - # runs-on: macos-latest - # env: - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 22 - # registry-url: https://registry.npmjs.org/ - # - run: npm ci - # - run: npm run build-mac_zip - - # mac_zip_universal-build: - # runs-on: macos-latest - # env: - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 22 - # registry-url: https://registry.npmjs.org/ - # - run: npm ci - # - run: npm run build-mac_zip_universal + linux-build: + runs-on: ubuntu-latest + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: https://registry.npmjs.org/ + - uses: samuelmeuli/action-snapcraft@v2 + - run: sudo dpkg --add-architecture i386 && sudo apt-get update -y && sudo apt-get install lzip elfutils libarchive-tools wine wine32 -y + - run: npm ci + - run: npm run build-linux - # win_universal-build: - # runs-on: windows-latest - # env: - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 22 - # registry-url: https://registry.npmjs.org/ - # - run: npm ci - # - run: npm run build-win_universal + windows-build: + runs-on: windows-latest + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm run build-win - # win_nsis-build: - # runs-on: windows-latest - # env: - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 22 - # registry-url: https://registry.npmjs.org/ - # - run: npm ci - # - run: npm run build-win_nsis + macos-build: + runs-on: macos-latest + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm run build-macos - # win_nsis_universal-build: - # runs-on: windows-latest - # env: - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 22 - # registry-url: https://registry.npmjs.org/ - # - run: npm ci - # - run: npm run build-win_nsis_universal + publish-npm: + runs-on: ubuntu-latest + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: https://registry.npmjs.org/ + - uses: samuelmeuli/action-snapcraft@v2 + - run: npm ci + - run: npm publish - # win_squirrel-build: - # runs-on: windows-latest - # env: - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 22 - # registry-url: https://registry.npmjs.org/ - # - run: npm ci - # - run: npm run build-win_squirrel + macos_universal-build: + runs-on: macos-latest + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm run build-mac_universal - # win_squirrel_universal-build: - # runs-on: windows-latest - # env: - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 22 - # registry-url: https://registry.npmjs.org/ - # - run: npm ci - # - run: npm run build-win_squirrel_universal + mac_zip-build: + runs-on: macos-latest + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm run build-mac_zip - # linux_apk-build: - # runs-on: ubuntu-latest - # env: - # SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 22 - # registry-url: https://registry.npmjs.org/ - # - uses: samuelmeuli/action-snapcraft@v2 - # - run: sudo dpkg --add-architecture i386 && sudo apt-get update -y && sudo apt-get install lzip elfutils libarchive-tools wine wine32 -y - # - run: npm ci - # - run: npm run build-linux_apk + mac_zip_universal-build: + runs-on: macos-latest + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm run build-mac_zip_universal - # linux_apk_universal-build: - # runs-on: ubuntu-latest - # env: - # SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 22 - # registry-url: https://registry.npmjs.org/ - # - uses: samuelmeuli/action-snapcraft@v2 - # - run: sudo dpkg --add-architecture i386 && sudo apt-get update -y && sudo apt-get install lzip elfutils libarchive-tools wine wine32 -y - # - run: npm ci - # - run: npm run build-linux_apk_universal + win_nsis-build: + runs-on: windows-latest + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: https://registry.npmjs.org/ + - uses: bduff9/use-npmrc@v2.0.0 + with: + dot-npmrc: ${{ secrets.DOT_NPMRC }} + - run: npm ci + - run: npm run build-win_nsis - # linux_flatpak-build: - # runs-on: ubuntu-latest - # env: - # SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # node-version: 18 - # registry-url: https://registry.npmjs.org/ - # - uses: samuelmeuli/action-snapcraft@v2 - # - run: sudo dpkg --add-architecture i386 && sudo apt-get update -y && sudo apt-get install flatpak flatpak-builder lzip elfutils libarchive-tools wine wine32 -y - # - run: npm ci - # - run: npm run build-linux_flatpak + win_squirrel-build: + runs-on: windows-latest + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: https://registry.npmjs.org/ + - uses: bduff9/use-npmrc@v2.0.0 + with: + dot-npmrc: ${{ secrets.DOT_NPMRC }} + - run: npm ci + - run: npm run build-win_squirrel - linux_flatpak_universal-build: + linux_apk-build: runs-on: ubuntu-latest env: SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} @@ -236,13 +145,12 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 registry-url: https://registry.npmjs.org/ - uses: bduff9/use-npmrc@v2.0.0 with: dot-npmrc: ${{ secrets.DOT_NPMRC }} - uses: samuelmeuli/action-snapcraft@v2 - - run: sudo dpkg --add-architecture i386 && sudo apt-get update -y && sudo apt-get install flatpak flatpak-builder lzip elfutils libarchive-tools wine wine32 -y - - run: npm install --save electron-prebuilt-compile + - run: sudo dpkg --add-architecture i386 && sudo apt-get update -y && sudo apt-get install lzip elfutils libarchive-tools wine wine32 -y - run: npm ci - - run: npm run build-linux_flatpak + - run: npm run build-linux_apk diff --git a/cn.cnoctave.marked-reader.yml b/cn.cnoctave.marked-reader.yml new file mode 100644 index 0000000..99b8877 --- /dev/null +++ b/cn.cnoctave.marked-reader.yml @@ -0,0 +1,53 @@ +app-id: cn.cnoctave.marked-reader +runtime: org.freedesktop.Platform +runtime-version: '23.08' +sdk: org.freedesktop.Sdk +base: org.electronjs.Electron2.BaseApp +base-version: '23.08' +sdk-extensions: + - org.freedesktop.Sdk.Extension.node18 +command: run.sh +separate-locales: false +finish-args: + - --share=ipc + - --socket=x11 + - --socket=pulseaudio + - --share=network +build-options: + append-path: /usr/bin/node + env: + NPM_CONFIG_LOGLEVEL: info +modules: + - name: marked-reader + buildsystem: simple + build-options: + env: + XDG_CACHE_HOME: /run/build/marked-reader/flatpak-node/cache + npm_config_cache: /run/build/marked-reader/flatpak-node/npm-cache + npm_config_offline: 'true' + build-commands: + # Install npm dependencies + - npm install --offline + # Build the app; in this example the `dist` script + # in package.json runs electron-builder + - | + . ../flatpak-node/electron-builder-arch-args.sh + npm run dist -- $ELECTRON_BUILDER_ARCH_ARGS --linux --dir + # Bundle app and dependencies + - cp -a dist/linux*unpacked /app/main + # Install app wrapper + - install -Dm755 -t /app/bin/ ../run.sh + subdir: main + sources: + #- type: archive + # url: https://github.com/flathub/marked-reader/archive/1.0.1.tar.gz + # sha256: a2feb3f1cf002a2e4e8900f718cc5c54db4ad174e48bfcfbddcd588c7b716d5b + - type: dir + path: .. + dest: main + - generated-sources.json + # Wrapper to launch the app + - type: script + dest-filename: run.sh + commands: + - zypak-wrapper.sh /app/main/marked-reader "$@" \ No newline at end of file diff --git a/linux_flatpak.json b/linux_flatpak.json index 7d2d90f..11a5478 100644 --- a/linux_flatpak.json +++ b/linux_flatpak.json @@ -23,7 +23,23 @@ "x64", "armv7l", "arm64" - ] + ], + "options": { + "bundle": "your-app-id", + "runtime": "org.freedesktop.Platform/x86_64/20.08", + "sdk": "org.freedesktop.Sdk/x86_64/20.08", + "metadata": { + "name": "marked_reader", + "description": "marked_reader is an open source Markdown reader packed by Electron", + "version": "1.2.0", + "com.github.app.url": "http://cnoctave.cn", + "com.github.app.license": "gpl-3.0+" + }, + "finishArgs": [ + "--socket=x11", + "--share=network" + ] + } } ] }