Deploy a DigitalOcean App Platform app using GitHub Actions.
- Auto-deploy your app from source on commit, while allowing you to run tests or perform other operations before.
- Auto-deploy your app from source and also update DigitalOcean Container Registry (DOCR) configuration in DigitalOcean App Spec and deploy application with updated DOCR image.
Note: This action only supports DOCR configuration changes for Auto-deploy
- Get DigitalOcean Personal Access token by following this instructions.(skip this step if you already have DigitalOcean Personal Access Token)
- Declare DigitalOcean Personal Access Token as DIGITALOCEAN_ACCESS_TOKEN variable in the secrets of github repository.
- Create a GitHub Action workflow file and add this step below to it or add this to your existing action.
- name: DigitalOcean App Platform deployment uses: ParamPatel207/app_action@main with: app_name: my_DO_app token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- This step will trigger a deploy to your App on DigitalOcean App Platform
- Get DigitalOcean Personal Access token by following this instructions(skip this step if you already have DigitalOcean Personal Access Token)
- Declare DigitalOcean Personal Access Token as DIGITALOCEAN_ACCESS_TOKEN variable in the secrets of github repository.
- Add this step to update DigitalOcean Container Registry configuration of single or multiple component in app_spec
- name: DigitalOcean App Platform deployment uses: ParamPatel207/app_action@main with: app_name: my_DO_app token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} images: '[ { "name": "sample-golang", "repository": "registry.digitalocean.com/sample-go/add_sample", "tag": "a5cae3e" }, { "name": "sample-add", "repository": "registry.digitalocean.com/sample-go/worker", "tag": "d3fb1c1" }, ]'
- DigitalOcean App Platform will now update your DOCR information in App Spec and then deploy your application.
- This step will trigger a DigitalOcean App Platform deployment of your app using the images specified.
Note: Always use unique tag names to push image to the DigitalOcean Container Registry. This will allow you to deploy your application without delay. ref
app_name
- Name of the app on App Platform.images
- (optional)List of json object for providing information about name, repository and tag of the image in docr.(by default latest tag is used)[{ "name": " ", "repository": " ", "tag": "" }]
name
- name of the component in App Specrepository
- name of the DOCR repository with the following format- registry.digitalocean.com//tag
- tag of the image provided while pushing to DOCR (by default latest tag is used). We suggest always use unique tag value)
token
- doctl authentication token (generate token by following this instructions
Update DigitalOcean Container Registry(DOCR) configuration of single component in App Spec example
DigitalOcean App Platform Auto-deploy with same app spec. example
- App Platform Guided App Spec Declaration
- App Platform App Spec Blog
- App Platform App Spec Components
Because image manifests are cached in different regions, there may be a maximum delay of one hour between pushing to a tag that already exists in your registry and being able to pull the new image by tag. This may happen, for example, when using the :latest tag. To avoid the delay, use:
- Unique tags (other than :latest)
- SHA hash of Github commit
- SHA hash of the new manifest
- Install gomock with
go install github.com/golang/mock/[email protected]
go generate ./...
to generate the mocks
This GitHub Action and associated scripts and documentation in this project are released under the MIT License.