Skip to content

Commit 13faa9e

Browse files
committed
Add publishing docs
1 parent 61fc40e commit 13faa9e

File tree

5 files changed

+147
-5
lines changed

5 files changed

+147
-5
lines changed

resources/views/docs/1/digging-deeper/updater.md

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: Publishing Your App
3+
order: 4
4+
---
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: Building
3+
order: 100
4+
---
5+
# Building Your App
6+
7+
Building your app is the process of compiling your application into a production-ready state. When building, NativePHP
8+
attempts to sign and notarize your application. Once signed, your app is ready to be distributed.
9+
10+
The build process compiles your app for one platform at a time. It compiles your application along with the
11+
Electron/Tauri runtime into a single executable.
12+
13+
Once built, you can distribute your app however you prefer, but NativePHP also provides a [publish command](publishing)
14+
that will automatically upload your build artifacts to your chosen [provider](/docs/publishing/updating) - this allows
15+
your app to provide automatic updates.
16+
17+
You should build your application for each platform you intend to support and test it on each platform _before_
18+
publishing to make sure that everything works as expected.
19+
20+
## Running a build
21+
22+
```shell
23+
php artisan native:build
24+
```
25+
26+
This will build for the platform and architecture where you are running the build.
27+
28+
### Cross-compilation
29+
30+
You can also specify a platform to build for by passing the `os` argument, so for example you could build for Windows
31+
whilst on a Mac:
32+
33+
```shell
34+
php artisan native:build windows
35+
```
36+
37+
Possible options are: `mac`, `win`, `linux`.
38+
39+
**Cross-compilation is not supported on all platforms.**
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: Publishing
3+
order: 200
4+
---
5+
# Publishing Your App
6+
7+
Publishing your app is similar to building, but in addition NativePHP will upload the build artifacts to your chosen
8+
[updater provider](/docs/publishing/updating) automatically.
9+
10+
## Running a build
11+
12+
```shell
13+
php artisan native:publish
14+
```
15+
16+
This will build for the platform and architecture where you are running the build.
17+
18+
### Cross-compilation
19+
20+
You can also specify a platform to build for by passing the `os` argument, so for example you could build for Windows
21+
whilst on a Mac:
22+
23+
```shell
24+
php artisan native:publish windows
25+
```
26+
27+
Possible options are: `mac`, `win`, `linux`.
28+
29+
**Cross-compilation is not supported on all platforms.**
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
title: Updating
3+
order: 300
4+
---
5+
# The Updater
6+
NativePHP ships with a built-in auto-update tool, which allows your users to update your application without needing to
7+
manually download and install new releases.
8+
9+
This leaves you to focus on building and releasing new versions of your application, without needing to worry about
10+
distributing those updates to your users.
11+
12+
**macOS: Automatic updating is only supported for [signed](/docs/publishing/building#signing-and-notarizing)
13+
applications.**
14+
15+
## How it works
16+
The updater works by checking a remote URL for a new version of your application. If a new version is found, the updater
17+
will download the new version and replace the existing application files with the new ones.
18+
19+
This means your application's builds need to be hosted online. NativePHP will automatically upload your application for
20+
you. After configuring the updater, simply use the [`php artisan native:publish`](/docs/publishing/publishing) command.
21+
22+
The updater supports two providers:
23+
24+
- Amazon S3 (`s3`)
25+
- DigitalOcean Spaces (`spaces`)
26+
27+
You can configure all settings for the updater in your `config/nativephp.php` file or via your `.env` file.
28+
29+
**The updater will only run when your app is running in production mode.**
30+
31+
## Configuration
32+
The default updater configuration looks like this:
33+
34+
```php
35+
'updater' => [
36+
'enabled' => env('NATIVEPHP_UPDATER_ENABLED', true),
37+
38+
'default' => env('NATIVEPHP_UPDATER_PROVIDER', 'spaces'),
39+
40+
'providers' => [
41+
's3' => [
42+
'driver' => 's3',
43+
'key' => env('AWS_ACCESS_KEY_ID'),
44+
'secret' => env('AWS_SECRET_ACCESS_KEY'),
45+
'region' => env('AWS_DEFAULT_REGION'),
46+
'bucket' => env('AWS_BUCKET'),
47+
'endpoint' => env('AWS_ENDPOINT'),
48+
'path' => env('NATIVEPHP_UPDATER_PATH', null),
49+
],
50+
51+
'spaces' => [
52+
'driver' => 'spaces',
53+
'key' => env('DO_SPACES_KEY_ID'),
54+
'secret' => env('DO_SPACES_SECRET_ACCESS_KEY'),
55+
'name' => env('DO_SPACES_NAME'),
56+
'region' => env('DO_SPACES_REGION'),
57+
'path' => env('NATIVEPHP_UPDATER_PATH', null),
58+
],
59+
],
60+
],
61+
```
62+
63+
How to setup your storage and generate the relevant API credentials:
64+
- [DigitalOcean](https://docs.digitalocean.com/products/spaces/how-to/manage-access/)
65+
- Amazon S3 - See [this video](https://www.youtube.com/watch?v=FLIp6BLtwjk&ab_channel=CloudCasts) by Chris Fidao or
66+
this [Step 2](https://www.twilio.com/docs/video/tutorials/storing-aws-s3#step-2) of this article by Twilio
67+
68+
## Disabling the updater
69+
70+
If you don't want your application to check for updates, you can disable the updater by setting the
71+
`updater.enabled` option to `false` in your `config/nativephp.php` file or via your `.env` file:
72+
73+
```dotenv
74+
NATIVEPHP_UPDATER_ENABLED=false
75+
```

0 commit comments

Comments
 (0)