-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add example with github deployments
- Loading branch information
Showing
2 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--- | ||
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 | ||
|
||
- name: Create deployment | ||
id: create_deployment | ||
uses: octokit/request-action@v2.x | ||
with: | ||
route: POST /repos/:repository/deployments | ||
repository: ${{ github.repository }} | ||
ref: ${{ github.sha }} | ||
environment: production | ||
required_contexts: '[]' | ||
production_environment: true | ||
env: | ||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | ||
|
||
- name: Set deployment status to in progress | ||
uses: octokit/request-action@v2.x | ||
with: | ||
route: POST /repos/:repository/deployments/:deployment/statuses | ||
repository: ${{ github.repository }} | ||
deployment: ${{ fromJson(steps.create_deployment.outputs.data).id }} | ||
environment: production | ||
environment_url: https://example.com | ||
log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
state: in_progress | ||
mediaType: '{"previews": ["flash", "ant-man"]}' # required for setting in_progress state and environment_url | ||
env: | ||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | ||
|
||
- name: Push to dokku | ||
uses: dokku/github-action@master | ||
with: | ||
git_remote_url: 'ssh://dokku@dokku.me:22/appname' | ||
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
|
||
- name: Set deployment status to success | ||
uses: octokit/request-action@v2.x | ||
with: | ||
route: POST /repos/:repository/deployments/:deployment/statuses | ||
repository: ${{ github.repository }} | ||
deployment: ${{ fromJson(steps.create_deployment.outputs.data).id }} | ||
environment: production | ||
environment_url: https://example.com | ||
log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
mediaType: '{"previews": ["ant-man"]}' # required for environment_url | ||
state: success | ||
env: | ||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | ||
|
||
- name: Set deployment status to failure | ||
uses: octokit/request-action@v2.x | ||
if: failure() | ||
with: | ||
route: POST /repos/:repository/deployments/:deployment/statuses | ||
repository: ${{ github.repository }} | ||
deployment: ${{ fromJson(steps.create_deployment.outputs.data).id }} | ||
environment: production | ||
environment_url: https://example.com | ||
log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
mediaType: '{"previews": ["ant-man"]}' # required for environment_url | ||
state: failure | ||
env: | ||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' |