Skip to content

Commit

Permalink
add experimental npm distribution (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyNikiforov authored Jun 10, 2023
1 parent 6636e8d commit 7aaa3ff
Show file tree
Hide file tree
Showing 20 changed files with 239 additions and 8 deletions.
45 changes: 44 additions & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:

- name: Build Release Executables (MacOS)
run: |
pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile icloudpd.py icloud.py --name icloudpd-${{needs.get_version.outputs.icloudpd_version}}-macos-amd64
pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile exec.py --name icloudpd-ex-${{needs.get_version.outputs.icloudpd_version}}-macos-amd64
if: ${{ matrix.os == 'macos-latest' }}

Expand Down Expand Up @@ -156,13 +157,55 @@ jobs:
path: |
dist
- name: Publish
- name: Publish PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python3 -m twine upload --non-interactive --disable-progress-bar dist/*.whl
publish_npm:
runs-on: ubuntu-latest
needs: [get_version,build]
steps:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16.x'

- name: Checkout code
uses: actions/checkout@v3

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts
path: |
dist
- name: Make Package
run: |
cp -r npm dist/npm
cp LICENSE.md dist/npm/icloudpd
mkdir dist/npm/@icloudpd/win32-x64/bin
mv dist/icloudpd-${{needs.get_version.outputs.icloudpd_version}}-windows-amd64.exe dist/npm/@icloudpd/win32-x64/bin/icloudpd.exe
cp LICENSE.md dist/npm/@icloudpd/win32-x64/
mkdir dist/npm/@icloudpd/linux-x64/bin
mv dist/icloudpd-${{needs.get_version.outputs.icloudpd_version}}-linux-amd64 dist/npm/@icloudpd/linux-x64/bin/icloudpd
cp LICENSE.md dist/npm/@icloudpd/linux-x64/
mkdir dist/npm/@icloudpd/darwin-x64/bin
mv dist/icloudpd-${{needs.get_version.outputs.icloudpd_version}}-macos-amd64 dist/npm/@icloudpd/darwin-x64/bin/icloudpd
cp LICENSE.md dist/npm/@icloudpd/darwin-x64/
- name: Publish NPM
run: |
npm publish dist/npm/@icloudpd/linux-x64
npm publish dist/npm/@icloudpd/win32-x64
npm publish dist/npm/@icloudpd/darwin-x64
npm publish dist/npm/icloudpd
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

release:
needs: [get_version, build]
runs-on: ubuntu-latest
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/quality-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ jobs:

- name: Build Release Executables (MacOS)
run: |
pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile icloudpd.py icloud.py --name icloudpd-${{needs.get_version.outputs.icloudpd_version}}-macos-amd64
pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile exec.py --name icloudpd-ex-${{needs.get_version.outputs.icloudpd_version}}-macos-amd64
if: ${{ matrix.os == 'macos-latest' }}

Expand Down Expand Up @@ -143,3 +144,43 @@ jobs:
tags: |
icloudpd/icloudpd:latest
icloudpd/icloudpd:${{needs.get_version.outputs.icloudpd_version}}
build_npm:
runs-on: ubuntu-latest
needs: [get_version,build]
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16.x'

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts
path: |
dist
- name: Make Package
run: |
cp -r npm dist/npm
cp LICENSE.md dist/npm/icloudpd
mkdir dist/npm/@icloudpd/win32-x64/bin
mv dist/icloudpd-${{needs.get_version.outputs.icloudpd_version}}-windows-amd64.exe dist/npm/@icloudpd/win32-x64/bin/icloudpd.exe
cp LICENSE.md dist/npm/@icloudpd/win32-x64/
mkdir dist/npm/@icloudpd/linux-x64/bin
mv dist/icloudpd-${{needs.get_version.outputs.icloudpd_version}}-linux-amd64 dist/npm/@icloudpd/linux-x64/bin/icloudpd
cp LICENSE.md dist/npm/@icloudpd/linux-x64/
mkdir dist/npm/@icloudpd/darwin-x64/bin
mv dist/icloudpd-${{needs.get_version.outputs.icloudpd_version}}-macos-amd64 dist/npm/@icloudpd/darwin-x64/bin/icloudpd
cp LICENSE.md dist/npm/@icloudpd/darwin-x64/
- name: Publish NPM (Dry-run)
run: |
npm publish dist/npm/@icloudpd/linux-x64 --dry-run=true
npm publish dist/npm/@icloudpd/win32-x64 --dry-run=true
npm publish dist/npm/@icloudpd/darwin-x64 --dry-run=true
npm publish dist/npm/icloudpd --dry-run=true
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ icloudpd-latest-py2.py3-none-any.whl
.venv
venv
*.spec
# exclude since there is no js development, just for local testing npm packaging
node_modules/
/package.json
/package-lock.json
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- experimental: add support for distributing `icloudpd` with [npm](README_NPM.md) package manager

## 1.13.0 (2023-04-21)

- fix: only delete files successfully downloaded [#614](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/614)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ When testing a bugfix it is important to test the faulty behavior and also the e
## How to release

We have github actions taking care for building, testing, and releasing software. Building and testing are happenning automatically on git pushed, pull requests, and merges. For releases the following steps are manual:
- Bump version in setup.py and any .md files
- Bump version in setup.py, all .md files, and all package.json files in npm subfolder
- Update CHANGELOG.md with date of the release
- Update CHANGELOG.md with release changes if they were not added with commits
- Commit & push/merge changes
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- A command-line tool to download all your iCloud photos.
- Works on Linux, Windows, and MacOS; laptop, desktop, and NAS
- Available as an executable for direct downloading and through package managers/ecosystems ([Docker](README_DOCKER.md), [PyPI](README_PYPI.md))
- Available as an executable for direct downloading and through package managers/ecosystems ([Docker](README_DOCKER.md), [PyPI](README_PYPI.md), Experimental: [Npm](README_NPM.md))
- Developed and maintained by volunteers (we are always looking for [help](CONTRIBUTING.md)).

We aim to release new versions once a week (Friday), if there is something worth delivering.
Expand All @@ -11,7 +11,7 @@ We aim to release new versions once a week (Friday), if there is something worth

There are three ways to run `icloudpd`:
1. Download executable for your platform from the Github [Release](https://github.com/icloud-photos-downloader/icloud_photos_downloader/releases) and run it
1. Use package manager to install, update, and, in some cases, run ([Docker](README_DOCKER.md), [PyPI](README_PYPI.md))
1. Use package manager to install, update, and, in some cases, run ([Docker](README_DOCKER.md), [PyPI](README_PYPI.md), Experimental: [Npm](README_NPM.md))
1. Build and run from the source

## Features
Expand Down
2 changes: 1 addition & 1 deletion README_DOCKER.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# iCloud Photos Downloader [![Quality Checks](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Quality%20Checks/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/quality-checks.yml) [![Multi Platform Docker Build](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Docker%20Build/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/docker-build.yml) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
# iCloud Photos Downloader [![Quality Checks](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Quality%20Checks/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/quality-checks.yml) [![Multi Platform Docker Build](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Docker%20Build/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/docker-build.yml) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md)

A command-line tool to download all your iCloud photos.

Expand Down
23 changes: 23 additions & 0 deletions README_NPM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# iCloud Photos Downloader [![Quality Checks](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Quality%20Checks/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/quality-checks.yml) [![Multi Platform Docker Build](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Docker%20Build/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/docker-build.yml) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md)

A command-line tool to download all your iCloud photos.

## [EXPERIMENTAL] Install, Run, and Use

``` sh
npx icloudpd --directory /data --username [email protected] --watch-with-interval 3600
```

Synchronization logic can be adjusted with command-line parameters. Run the following to get full list:

``` sh
npx icloudpd --help
```

## Getting Node and Npm

You can get NodeJS with accompanying Npm from [Official site](https://nodejs.org/en/download).

## More

See [Project page](https://github.com/icloud-photos-downloader/icloud_photos_downloader/) for more details.
4 changes: 2 additions & 2 deletions README_PYPI.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# iCloud Photos Downloader [![Quality Checks](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Quality%20Checks/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/quality-checks.yml) [![Multi Platform Docker Build](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Docker%20Build/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/docker-build.yml) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
# iCloud Photos Downloader [![Quality Checks](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Quality%20Checks/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/quality-checks.yml) [![Multi Platform Docker Build](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Docker%20Build/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/docker-build.yml) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md)

A command-line tool to download all your iCloud photos.

## Install, Run, and Use
## Install

``` sh
pip install icloudpd
Expand Down
3 changes: 3 additions & 0 deletions npm/@icloudpd/darwin-x64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# icloudpd

The macOS 64-bit binary for icloudpd, a iCloud Photo Downloader. See https://github.com/icloud_photo_downloader/icloud_photo_downloader for details.
17 changes: 17 additions & 0 deletions npm/@icloudpd/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@icloudpd/darwin-x64",
"version": "1.13.0",
"description": "The macOS 64-bit binary for icloudpd, a iCloud Photo Downloader.",
"repository": "https://github.com/icloud_photo_downloader/icloud_photo_downloader",
"license": "MIT",
"engines": {
"node": ">=12"
},
"preferUnplugged": true,
"os": [
"darwin"
],
"cpu": [
"x64"
]
}
3 changes: 3 additions & 0 deletions npm/@icloudpd/linux-x64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# icloudpd

The Linux 64-bit binary for icloudpd, a iCloud Photo Downloader. See https://github.com/icloud_photo_downloader/icloud_photo_downloader for details.
17 changes: 17 additions & 0 deletions npm/@icloudpd/linux-x64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@icloudpd/linux-x64",
"version": "1.13.0",
"description": "The Linux 64-bit binary for icloudpd, a iCloud Photo Downloader.",
"repository": "https://github.com/icloud_photo_downloader/icloud_photo_downloader",
"license": "MIT",
"engines": {
"node": ">=12"
},
"preferUnplugged": true,
"os": [
"linux"
],
"cpu": [
"x64"
]
}
3 changes: 3 additions & 0 deletions npm/@icloudpd/win32-x64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# icloudpd

The Windows 64-bit binary for icloudpd, a iCloud Photo Downloader. See https://github.com/icloud_photo_downloader/icloud_photo_downloader for details.
17 changes: 17 additions & 0 deletions npm/@icloudpd/win32-x64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@icloudpd/win32-x64",
"version": "1.13.0",
"description": "The Windows 64-bit binary for icloudpd, a iCloud Photo Downloader.",
"repository": "https://github.com/icloud_photo_downloader/icloud_photo_downloader",
"license": "MIT",
"preferUnplugged": true,
"engines": {
"node": ">=12"
},
"os": [
"win32"
],
"cpu": [
"x64"
]
}
3 changes: 3 additions & 0 deletions npm/icloudpd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# icloudpd

iCloud Photo Downloader. See https://github.com/icloud_photo_downloader/icloud_photo_downloader for details.
25 changes: 25 additions & 0 deletions npm/icloudpd/bin/icloudpd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env node
"use strict";
var os = require("os");
var platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
var knownPlatforms = {
"linux x64 LE": {
"pkgName": "@icloudpd/linux-x64",
"subPath": "bin/icloudpd"
},
"darwin x64 LE": {
"pkgName": "@icloudpd/darwin-x64",
"subPath": "bin/icloudpd"
},
"win32 x64 LE": {
"pkgName": "@icloudpd/win32-x64",
"subPath": "bin/icloudpd.exe"
}
};
if (platformKey in knownPlatforms) {
var { pkgName, subPath } = knownPlatforms[platformKey];
var binPath = require.resolve(`${pkgName}/${subPath}`);
require("child_process").execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
} else {
throw new Error(`Unsupported platform: ${platformKey}`);
}
30 changes: 30 additions & 0 deletions npm/icloudpd/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "icloudpd",
"version": "1.13.0",
"description": "iCloud Photo Downloader",
"engines": {
"node": ">=12"
},
"bin": {
"icloudpd": "bin/icloudpd.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/icloud_photos_downloader/icloud_photos_downloader.git"
},
"keywords": [
"icloud",
"photo"
],
"author": "The iCloud Photo Downloader Authors",
"license": "MIT",
"bugs": {
"url": "https://github.com/icloud_photos_downloader/icloud_photos_downloader/issues"
},
"homepage": "https://github.com/icloud_photos_downloader/icloud_photos_downloader#readme",
"optionalDependencies": {
"@icloudpd/linux-x64": "1.13.0",
"@icloudpd/win32-x64": "1.13.0",
"@icloudpd/darwin-x64": "1.13.0"
}
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
description=(
"icloudpd is a command-line tool to download photos and videos from iCloud."
),
maintainer="The iCloud Authors",
maintainer="The iCloud Photo Downloader Authors",
maintainer_email=" ",
license="MIT",
packages=find_packages(),
Expand Down

0 comments on commit 7aaa3ff

Please sign in to comment.