github-action icon indicating copy to clipboard operation
github-action copied to clipboard

docs: add example with github deployments

Open badsyntax opened this issue 5 years ago • 1 comments

Although not specific to the dokku workflow, it might be helpful to include examples of how to use GitHub deploys.

I recently set this up on my repo and find it somewhat useful.

Here's an example of the GitHub deploys:

Screenshot 2021-01-12 at 10 47 21

I find it especially useful in pull requests. In my case i'm using the review-apps:create feature to create a staging deploy when I add a "staging" label to my PR.

In progress:

Screenshot 2021-01-12 at 10 50 47

Complete:

Screenshot 2021-01-12 at 10 52 02

badsyntax avatar Jan 12 '21 10:01 badsyntax

Hello, the GH deployments API is out of preview and also is another action that handles creating and displaying GH deployments - for anyone looking here's an example:

---
name: 'deploy'

# yamllint disable-line rule:truthy
on:
  push:
    branches:
      - master

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Cloning repo
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - uses: chrnorm/deployment-action@v2
        name: Create GitHub deployment
        id: deployment
        with:
          token: '${{ github.token }}'
          environment-url: 'https://appname.dokku.me'
          environment: 'production'

      - name: Push to dokku
        uses: dokku/github-action@master
        with:
          git_remote_url: 'ssh://[email protected]:22/appname'
          ssh_private_key: '${{ secrets.SSH_PRIVATE_KEY }}'

      - name: Update deployment status (success)
        if: success()
        uses: chrnorm/deployment-status@v2
        with:
          token: '${{ github.token }}'
          environment-url: '${{ steps.deployment.outputs.environment_url }}'
          deployment-id: '${{ steps.deployment.outputs.deployment_id }}'
          state: 'success'

      - name: Update deployment status (failure)
        if: failure()
        uses: chrnorm/deployment-status@v2
        with:
          token: '${{ github.token }}'
          environment-url: '${{ steps.deployment.outputs.environment_url }}'
          deployment-id: '${{ steps.deployment.outputs.deployment_id }}'
          state: 'failure'

Other than this dokku action, the third party actions in use are:

https://github.com/chrnorm/deployment-action https://github.com/chrnorm/deployment-status

rjocoleman avatar May 24 '22 06:05 rjocoleman