serverpod-cloud-deploy deploys a project to Serverpod Cloud.
This is a simple workflow example that uses this action.
name: Automated Serverpod Cloud deploy
on:
push:
branches: [main]
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
- uses: serverpod/serverpod-cloud-deploy@v0.3
with:
token: ${{ secrets.MY_SERVERPOD_CLOUD_ACCESS_TOKEN }}Prerequisites:
-
A GitHub secret has been set containing the access token
(create a token with
scloud auth create-token) -
serverpod generatehas been run and the generated files are committed -
scloud.yamlis committed in the server package(create this file with
scloud launchorscloud link) -
The repository has only one Serverpod project and it is no more than two subdirectory levels down from the root
The action takes the following inputs:
-
Required:
token: Serverpod Cloud access token.
-
Optional:
-
working_directory: Path to the action's working directory. Default value is. -
project_id: Tenant project ID. -
project_dir: Path to the project's server directory. -
project_config_file: Path to the project's configuration file.
-
The following workflow example does not requires the generated serverpod files to be committed nor the scloud.yaml file to be available.
name: Automated Serverpod Cloud generate & deploy
description: >
Checks out the repository, sets up Flutter, runs serverpod generate,
and deploys to Serverpod Cloud.
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
env:
# Change these values according to your project
PROJECT_ID: my-project-id
SERVER_DIR: ./packages/my_server
CLOUD_TOKEN: ${{ secrets.MY_SERVERPOD_CLOUD_ACCESS_TOKEN }}
jobs:
generate-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Flutter SDK
uses: subosito/flutter-action@v2
with:
# Picks the latest stable version. Some may want to pin the version instead.
channel: stable
cache: true
- name: Run serverpod generate
working-directory: ${{ env.SERVER_DIR }}
# Automatically picks the used Serverpod version from dependencies
run: dart run serverpod_cli generate
- uses: serverpod/serverpod_cloud_deploy@v0.3
with:
token: ${{ env.CLOUD_TOKEN }}
project_id: ${{ env.PROJECT_ID }}
project_dir: ${{ env.SERVER_DIR }}See the LICENSE file.
Contributions are welcome! Please see CONTRIBUTING.md.
Please see our CHANGELOG.md file.
