mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 03:15:43 +08:00
docs: some steps to use gh pages (#1059)
* docs: some steps to use gh pages * Update doc/platforms.md * Apply suggestions from code review Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com> Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
This commit is contained in:
@ -26,6 +26,54 @@ To build the game for production, using skia, use the following:
|
|||||||
$ flutter build web --release --web-renderer canvaskit
|
$ flutter build web --release --web-renderer canvaskit
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Deploy your game to GitHub Pages
|
||||||
|
|
||||||
|
One easy way to deploy your game online, is to use [GitHub Pages](https://pages.github.com/).
|
||||||
|
It is a cool feature from GitHub, by which you can easily host web content from your repository.
|
||||||
|
|
||||||
|
Here we will explain the easiest way to get your game hosted using GitHub pages.
|
||||||
|
|
||||||
|
First thing, lets create the branch where your deployed files will live:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git checkout -b gh-pages
|
||||||
|
```
|
||||||
|
|
||||||
|
This branch can be created from `main` or any other place, it doesn't matter much. After you push that
|
||||||
|
branch go back to your `main` branch.
|
||||||
|
|
||||||
|
Now you should add the [flutter-gh-pages](https://github.com/bluefireteam/flutter-gh-pages)
|
||||||
|
action to your repository, you can do that by creating a file `gh-pages.yaml` under the folder
|
||||||
|
`.github/workflows`.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: Gh-Pages
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: subosito/flutter-action@v1
|
||||||
|
- uses: bluefireteam/flutter-gh-pages@v7
|
||||||
|
with:
|
||||||
|
baseHref: /NAME_OF_YOUR_REPOSITORY/
|
||||||
|
webRenderer: canvaskit
|
||||||
|
```
|
||||||
|
|
||||||
|
Be sure to change `NAME_OF_YOUR_REPOSITORY` to the name of your GitHub repository.
|
||||||
|
|
||||||
|
Now, whenever you push something to the `main` branch, the action will run and update your
|
||||||
|
deployed game.
|
||||||
|
|
||||||
|
The game should be available at an URL like this:
|
||||||
|
`https://YOUR_GITHUB_USERNAME.github.io/YOUR_REPO_NAME/`
|
||||||
|
|
||||||
### Web support
|
### Web support
|
||||||
|
|
||||||
When using Flame on the web some methods may not work. For example `Flame.device.setOrientation` and
|
When using Flame on the web some methods may not work. For example `Flame.device.setOrientation` and
|
||||||
|
|||||||
Reference in New Issue
Block a user