Skip to content

Commit 24f6a92

Browse files
authored
Update README.md before the v3 release
1 parent f81622d commit 24f6a92

File tree

1 file changed

+58
-1
lines changed

1 file changed

+58
-1
lines changed

README.md

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,65 @@ jobs:
7171
with:
7272
# ruby-version: 3.0.1 # Not needed with a .ruby-version file
7373
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
74-
- uses: miloserdow/capistrano-deploy@master
74+
- uses: miloserdow/capistrano-deploy@v3 # you can use miloserdow/capistrano-deploy@master for the cuurent stable dev version
7575
with:
7676
target: development # Defines the environment that will be used for the deployment
7777
deploy_key: ${{ secrets.DEPLOY_ENC_KEY }} # Name of the variable configured in Settings/Secrets of your github project
7878
```
79+
80+
## Example running this action with custom commands
81+
In this example we are starting rails and Sidekiq with Capistrano
82+
83+
### Personal access token
84+
You need to create a personal access token with "repo" access like described here:
85+
https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token
86+
87+
### Dispatch workflow
88+
Create a new dispatch workflow like described here: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#create-a-workflow-dispatch-event
89+
90+
### Workflow file:
91+
```yml
92+
name: Start Rails and Sidekiq with Capistrano
93+
94+
on:
95+
workflow_dispatch:
96+
inputs:
97+
environment:
98+
description: "The environment to deploy"
99+
required: true
100+
101+
jobs:
102+
deploy:
103+
runs-on: ubuntu-latest
104+
steps:
105+
- name: Checkout
106+
uses: actions/checkout@v2
107+
- name: Turnstyle
108+
uses: softprops/turnstyle@master
109+
env:
110+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111+
with:
112+
abort-after-seconds: 3600
113+
- name: Set up Ruby
114+
uses: ruby/setup-ruby@v1
115+
with:
116+
ruby-version: 2.6.6
117+
bundler-cache: true
118+
- name: Deploy
119+
uses: kaspernj/capistrano-deploy@custom-capistrano-command
120+
with:
121+
capistrano_commands: '["puma:start", "sidekiq:start"]'
122+
target: ${{ github.event.inputs.environment }}
123+
deploy_key: ${{ secrets.DEPLOY_ENC_KEY }}
124+
```
125+
126+
### Curl command
127+
```bash
128+
curl \
129+
-X POST \
130+
-H "Accept: application/vnd.github.v3+json" \
131+
-H "Authorization: Bearer $PERSONAL_GITHUB_TOKEN" \
132+
https://api.github.com/repos/$GITHUB_USERNAME/$GITHUB_REPO_NAME/actions/workflows/$WORKFLOW_FILE_NAME/dispatches \
133+
-d "{\"ref\":\"master\",\"inputs\":{\"environment\":\"$ENVIRONMENT_TO_DEPLOY\"}}"
134+
```
135+
This command makes Github start Rails and Sidekiq at the deployment.

0 commit comments

Comments
 (0)