Skip to content

serverpod/serverpod_cloud_deploy

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverpod banner

serverpod-cloud-deploy

serverpod-cloud-deploy deploys a project to Serverpod Cloud.

Usage

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 generate has been run and the generated files are committed

  • scloud.yaml is committed in the server package

    (create this file with scloud launch or scloud link)

  • The repository has only one Serverpod project and it is no more than two subdirectory levels down from the root

Inputs

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.

Combine with serverpod generate

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 }}

License

See the LICENSE file.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md.

Version history

Please see our CHANGELOG.md file.

About

GitHub Action for Serverpod Cloud deployment automation.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published