{"id":28578155,"url":"https://github.com/digitalocean/app_action","last_synced_at":"2025-06-11T01:09:00.961Z","repository":{"id":37830280,"uuid":"395728769","full_name":"digitalocean/app_action","owner":"digitalocean","description":"⛵ App Platform - Deploy to DigitalOcean Container Registry and App Platform","archived":false,"fork":false,"pushed_at":"2025-05-30T02:36:38.000Z","size":12276,"stargazers_count":129,"open_issues_count":10,"forks_count":19,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-06-01T11:53:15.706Z","etag":null,"topics":["app-platform","digitalocean","digitalocean-app-platform","digitalocean-apps","hacktoberfest"],"latest_commit_sha":null,"homepage":"https://docs.digitalocean.com/products/app-platform","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"ParamPatel207/app_action","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digitalocean.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-13T16:56:30.000Z","updated_at":"2025-05-24T04:48:16.000Z","dependencies_parsed_at":"2024-01-18T07:48:41.330Z","dependency_job_id":"909ba5d4-783c-466c-afc0-c15a0b84a827","html_url":"https://github.com/digitalocean/app_action","commit_stats":{"total_commits":160,"total_committers":6,"mean_commits":"26.666666666666668","dds":0.59375,"last_synced_commit":"f162702068293fb833b29ece5dcb27638c0f05ec"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fapp_action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fapp_action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fapp_action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fapp_action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalocean","download_url":"https://codeload.github.com/digitalocean/app_action/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fapp_action/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259178492,"owners_count":22817388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["app-platform","digitalocean","digitalocean-app-platform","digitalocean-apps","hacktoberfest"],"created_at":"2025-06-11T01:09:00.218Z","updated_at":"2025-06-11T01:09:00.935Z","avatar_url":"https://github.com/digitalocean.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deploy a [DigitalOcean App Platform](https://www.digitalocean.com/products/app-platform/) app using GitHub Actions.\n\nDeploy an app from source (including the configuration) on commit, while allowing you to run tests or perform other operations as part of your CI/CD pipeline.\n\n- Supports picking up an in-repository (or filesystem really) `app.yaml` (defaults to `.do/app.yaml`, configurable via the `app_spec_location` input) to create the app from instead of having to rely on an already existing app that's then downloaded (though that is still supported). The in-filesystem app spec can also be templated with environment variables automatically (see examples below).\n- Prints the build and deploy logs into the Github Action log on demand (configurable via `print_build_logs` and `print_deploy_logs`) and surfaces them as outputs `build_logs` and `deploy_logs`.\n- Provides the app's metadata as the output `app`.\n- Supports a \"preview mode\" geared towards orchestrating per-PR app previews. It can be enabled via `deploy_pr_review`, see the [Implementing Preview Apps](#launch-a-preview-app-per-pull-request) example.\n\n## Support\n\nIf you require assistance or have a feature idea, please create a support ticket at the [official DigitalOcean Support](https://cloudsupport.digitalocean.com/s/).\n\n## Documentation\n\n### `deploy` action\n\n#### Inputs\n\n- `token`: DigitalOcean Personal Access Token. See https://docs.digitalocean.com/reference/api/create-personal-access-token/ for creating a new token.\n- `app_spec_location`: Location of the app spec file. Defaults to `.do/app.yaml`.\n- `project_id`: ID of the project to deploy the app to. If not given, the app will be deployed to the default project.\n- `app_name`: Name of the app to pull the spec from. The app must already exist. If an app name is given, a potential in-repository app spec is ignored.\n- `print_build_logs`: Print build logs. Defaults to `false`.\n- `print_deploy_logs`: Print deploy logs. Defaults to `false`.\n- `deploy_pr_preview`: Deploy the app as a PR preview. The app name will be derived from the PR, the app spec will be modified to exclude conflicting configuration like domains and alerts and all Github references to the current repository will be updated to point to the PR's branch. Defaults to `false`.\n\n#### Outputs\n\n- `app`: A JSON representation of the entire app after the deployment.\n- `build_logs`: The builds logs of the deployment.\n- `deploy_logs`: The deploy logs of the deployment.\n\n### `delete` action\n\n#### Inputs\n\n- `token`: DigitalOcean Personal Access Token. See https://docs.digitalocean.com/reference/api/create-personal-access-token/ for creating a new token.\n- `app_id`: ID of the app to delete.\n- `app_name`: Name of the app to delete.\n- `from_pr_preview`: Use this if the app was deployed as a PR preview. The app name will be derived from a combination of the repo name and the PR.\n- `ignore_not_found`: Ignore if the app is not found.\n\n## Usage\n\nAs a prerequisite for all examples, you'll need a `DIGITALOCEAN_ACCESS_TOKEN`[secret](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository) in the respective repository. If not already done, get a DigitalOcean Personal Access token by following this [instructions](https://docs.digitalocean.com/reference/api/create-personal-access-token/) and declare it as that secret in the repository you're working with.\n\n### Deploy an app (with a referenced secret)\n\nWith the following contents of `.do/app.yaml` in the repository:\n\n```yaml\nname: sample\nservices:\n- name: sample\n  envs:\n  - key: SOME_SECRET\n    value: ${SOME_SECRET_FROM_REPOSITORY}\n    type: SECRET\n  github:\n    branch: main\n    repo: digitalocean/sample-golang\n```\n\nThe following action deploys the app whenever a new commit is pushed to the main branch. Note that `deploy_on_push` is **not** used here, since the Github Action is the driving force behind the deployment. Updates to `.do/app.yaml` will automatically be applied to the app.\n\nIn this case, a secret of the repository named `SOME_SECRET_FROM_REPOSITORY` will also be passed into the app via its environment variables as `SOME_SECRET`. It is passed to the action's environment via the `${{ secrets.KEY }}` notation and then substituted into the spec itself via the environment variable reference in `value`. Make sure to define the respective env var's type as `SECRET` in the spec to ensure the value is stored in an encrypted way.\n\n**Note:** `APP_DOMAIN`, `APP_URL` and `APP_ID` are predefined [App-wide variables](https://docs.digitalocean.com/products/app-platform/how-to/use-environment-variables/#app-wide-variables). Avoid overriding them in the action's environment to avoid the env-var-expansion process of the Github Action to interfere with that of the platform itself.\n\n```yaml\nname: Update App\n\non:\n  push:\n    branches: [main]\n\npermissions:\n  contents: read\n\njobs:\n  deploy-app:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout repository\n        uses: actions/checkout@v4\n      - name: Deploy the app\n        uses: digitalocean/app_action/deploy@v2\n        env:\n          SOME_SECRET_FROM_REPOSITORY: ${{ secrets.SOME_SECRET_FROM_REPOSITORY }}\n        with:\n          token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}\n```\n\n### Deploy an app with a prebuilt image\n\nWith the following contents of `.do/app.yaml` in the repository:\n\n```yaml\nname: sample\nservices:\n- name: sample\n  image:\n    registry_type: GHCR\n    registry: YOUR_ORG\n    repository: YOUR_REPO\n    registry_credentials: ${GHCR_CREDENTIALS}\n    digest: ${SAMPLE_DIGEST}\n```\n\nThe following action builds a new image from a Dockerfile in the repository and deploys the respective app from it. The build in App Platform is automatically bypassed. The built image is deployed from its digest, avoiding any inconsistencies around mutable tags and guaranteeing that **exactly** this image is deployed.\n\nSimilar to how we've passed the `SOME_SECRET_FROM_REPOSITORY` secret as an environment variable in the paragraph above, a secret of the repository, named for example `GHCR_CREDENTIALS` (which will have to be setup beforehand as well), can be passed to the app as [registry_credentials](https://docs.digitalocean.com/products/app-platform/how-to/deploy-from-container-images/#deploy-container-using-the-apps) to allow the deployment to pull the container image we're building, if the resulting image is private.\n\n```yaml\nname: Build, Push and Deploy a Docker Image\n\non:\n  push:\n    branches: [main]\n\npermissions:\n  contents: read\n  packages: write\n\njobs:\n  build-push-deploy-image:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout repository\n        uses: actions/checkout@v4\n      - name: Log in to the Container registry\n        uses: docker/login-action@v3.3.0\n        with:\n          registry: ghcr.io\n          username: ${{ github.actor }}\n          password: ${{ secrets.GITHUB_TOKEN }}\n      - name: Build and push Docker image\n        id: push\n        uses: docker/build-push-action@v6.5.0\n        with:\n          context: .\n          push: true\n          tags: ghcr.io/${{ github.repository }}:latest\n      - name: Deploy the app\n        uses: digitalocean/app_action/deploy@v2\n        env:\n          SAMPLE_DIGEST: ${{ steps.push.outputs.digest }}\n          GHCR_CREDENTIALS: ${{ secrets.GHCR_CREDENTIALS }}\n        with:\n          token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}\n```\n\n### Launch a preview app per pull request\n\nWith the following contents of `.do/app.yaml` in the repository:\n\n```yaml\nname: sample\nservices:\n- name: sample\n  github:\n    branch: main\n    repo: digitalocean/sample-golang\n```\n\nThe following 2 actions implement a \"Preview Apps\" feature, that provide a per-PR app to check if the deployment **would** work. If the deployment succeeds, a comment is posted with the live URL of the app. If the deployment fails, a link to the respective action run is posted alongside the build and deployment logs for quick debugging.\n\nOnce the PR is closed or merged, the respective app is deleted again.\n\n```yaml\nname: App Platform Preview\n\non:\n  pull_request:\n    branches: [main]\n\npermissions:\n  contents: read\n  pull-requests: write\n\njobs:\n  test:\n    name: preview\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout repository\n        uses: actions/checkout@v4\n      - name: Deploy the app\n        id: deploy\n        uses: digitalocean/app_action/deploy@v2\n        with:\n          deploy_pr_preview: \"true\"\n          token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}\n      - uses: actions/github-script@v7\n        env:\n          BUILD_LOGS: ${{ steps.deploy.outputs.build_logs }}\n          DEPLOY_LOGS: ${{ steps.deploy.outputs.deploy_logs }}\n        with:\n          script: |\n            const { BUILD_LOGS, DEPLOY_LOGS } = process.env\n            github.rest.issues.createComment({\n              issue_number: context.issue.number,\n              owner: context.repo.owner,\n              repo: context.repo.repo,\n              body: `:rocket: :rocket: :rocket: The app was successfully deployed at ${{ fromJson(steps.deploy.outputs.app).live_url }}.`\n            })\n      - uses: actions/github-script@v7\n        if: failure()\n        with:\n          script: |\n            github.rest.issues.createComment({\n              issue_number: context.issue.number,\n              owner: context.repo.owner,\n              repo: context.repo.repo,\n              body: `The app failed to be deployed. Logs can be found [here](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).\n\n              ## Logs\n              \u003cdetails\u003e\n              \u003csummary\u003eBuild logs\u003c/summary\u003e\n\n              \\`\\`\\`\n              ${BUILD_LOGS}\n              \\`\\`\\`\n              \u003c/details\u003e\n\n              \u003cdetails\u003e\n              \u003csummary\u003eDeploy logs\u003c/summary\u003e\n\n              \\`\\`\\`\n              ${DEPLOY_LOGS}\n              \\`\\`\\`\n              \u003c/details\u003e`\n            })\n```\n\n```yaml\nname: Delete Preview\n\non:\n  pull_request:\n    types: [ closed ]\n\njobs:\n  closed:\n    runs-on: ubuntu-latest\n    steps:\n      - name: delete preview app\n        uses: digitalocean/app_action/delete@v2\n        with:\n          from_pr_preview: \"true\"\n          ignore_not_found: \"true\"\n          token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}\n```\n\n## Note for handling container images\n\nIt is strongly suggested to use image digests to identify a specific image like in the example above. If that is not possible, it is strongly suggested to use a unique and descriptive tag for the respective image (not `latest`).\n\n## Upgrade from v1.x\n\nThe v1 branch of this action is no longer under active development. Its documentation is [still available](https://github.com/digitalocean/app_action/blob/v1/README.md) though.\n\nTo upgrade, the reference to the action has to be changed from `digitalocean/app_action@v1.x.x` to `digitalocean/app_action/deploy@v2.x.x` (note the new `deploy` part of the path).\n\n### Updating images\n\nThe new deploy action does not support the `images` input from the old action. For in-repository app specs, it's suggested to use env-var-substitution as in the example above. \n\nIf the spec of an existing app should be updated via the backwards-compatible `app_name` input, the `IMAGE_DIGEST_$component-name` environment variable can be used to update the `digest` field and the `IMAGE_TAG_$component-name` environment variables can be used to update the `tag` field of a component's image reference.\n\n```yaml\nname: sample-app\nservices:\n- name: sample-service\n  image:\n    registry_type: GHCR\n    registry: YOUR_ORG\n    repository: YOUR_REPO\n    tag: v1\n```\n\n```yaml\n- name: Deploy the app\n  uses: digitalocean/app_action/deploy@v2\n  env:\n    IMAGE_TAG_SAMPLE_SERVICE: v2\n  with:\n    token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}\n    app_name: sample-app\n```\n\nIn this example, the tag of the referenced image (hence the `IMAGE_TAG_` prefix) of the `sample-service` will be updated from `v1` to `v2`. Service names are translated to environment variable names by uppercasing them and by replacing dashes with underscores (`service-name` to `SERVICE_NAME` in this case).\n\n## Resources to know more about DigitalOcean App Platform App Spec\n\n- [App Platform Guided App Spec Declaration](https://www.digitalocean.com/community/tech_talks/defining-your-app-specification-on-digitalocean-app-platform)\n- [App Platform App Spec Blog](https://docs.digitalocean.com/products/app-platform/reference/app-spec/)\n- [App Platform App Spec Components](https://www.digitalocean.com/blog/build-component-based-apps-with-digitalocean-app-platform/)\n\n## License\n\nThis GitHub Action and associated scripts and documentation in this project are released under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalocean%2Fapp_action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalocean%2Fapp_action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalocean%2Fapp_action/lists"}