{"id":13410512,"url":"https://github.com/miloserdow/capistrano-deploy","last_synced_at":"2025-03-14T16:32:21.739Z","repository":{"id":36526953,"uuid":"216281273","full_name":"miloserdow/capistrano-deploy","owner":"miloserdow","description":"Github Actions for Capistrano","archived":false,"fork":false,"pushed_at":"2024-10-21T06:04:04.000Z","size":1006,"stargazers_count":129,"open_issues_count":10,"forks_count":43,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-02T20:34:24.451Z","etag":null,"topics":["capistrano","deployment-automation","github-action","github-actions"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miloserdow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2019-10-19T23:07:16.000Z","updated_at":"2025-01-29T12:12:20.000Z","dependencies_parsed_at":"2024-06-02T22:32:13.373Z","dependency_job_id":"47720766-b899-4fd8-9851-e3b440c17105","html_url":"https://github.com/miloserdow/capistrano-deploy","commit_stats":{"total_commits":66,"total_committers":15,"mean_commits":4.4,"dds":0.5606060606060606,"last_synced_commit":"24f6a92bc02b5a708c92095566335f46b411afc9"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miloserdow%2Fcapistrano-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miloserdow%2Fcapistrano-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miloserdow%2Fcapistrano-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miloserdow%2Fcapistrano-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miloserdow","download_url":"https://codeload.github.com/miloserdow/capistrano-deploy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243419071,"owners_count":20287805,"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":["capistrano","deployment-automation","github-action","github-actions"],"created_at":"2024-07-30T20:01:07.410Z","updated_at":"2025-03-14T16:32:21.111Z","avatar_url":"https://github.com/miloserdow.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Capistrano actions\n\nGithub deploy action for Capistrano. Use this action to automate your capistrano deployment process.\n\n## Dependencies\n\nThis action expects Ruby to be installed along with Capistrano, see below for a [basic workflow example](#workflow-example) that uses [ruby/setup-ruby](https://github.com/ruby/setup-ruby).\n\n## Inputs\n\n### `target`\n\nEnvironment where deploy is to be performed to. E.g. \"production\", \"staging\". Default value is empty.\n\n### `deploy_key`\n\n**Required** Symmetric key to decrypt private\nkey. Must be a string.\n\n### `enc_rsa_key_pth`\n\nPath to the encrypted key. Default `\"config/deploy_id_rsa_enc\"`. You have to use either `enc_rsa_key_pth` or `enc_rsa_key_val`.\n\n### `enc_rsa_key_val`\n\nContents of the encrypted key. Best to use as repository secret. You have to use either `enc_rsa_key_pth` or `enc_rsa_key_val`.\n\n### `working-directory`\n\nThe directory from which to run the deploy commands, including `bundle install`.\n\n## Outputs\n\nNo outputs\n\n## Setting up CD using this action\n\n1. Generate SSH keys on the target machine\n\n```bash\n$ ssh-keygen -t ed25519\n```\n\n2. Export public key to the `authorized_keys` to allow the usage of this keypair to login\n\n```bash\n$ cat ~/.ssh/id_ed25519.pub \u003e\u003e ~/.ssh/authorized_keys\n```\n\n3. Add public key from `~/.ssh/id_ed25519.pub` to your repository's deployment keys via _Settings / Deploy keys / Add_\n4. Encrypt your private key with a strong password. **Please use these options**, otherwise this action may not be able to decrypt your key.\n\n```bash\n$ openssl enc -aes-256-cbc -md sha512 -salt -in ~/.ssh/id_ed25519 -out deploy_id_ed25519_enc -k \"PASSWORD\" -a -pbkdf2\n```\n\n5. Add `deploy_id_ed25519_enc` file to your repository. Suggested path is `config/deploy_id_ed25519_enc`\n6. Save the password used in step 4 as a secret in repository settings via _Settings / Secrets / Add_\n7. Create YAML configuration for your workflow (example below)\n\n## Workflow example\n\n```yaml\n# This is a basic workflow to help you get started with Actions\nname: Deploy with Capistrano\n\n# Controls when the action will run.\non:\n  # Triggers the workflow on push or pull request events but only for the main branch\n  push:\n    branches: [main]\n\n  # Allows you to run this workflow manually from the Actions tab\n  workflow_dispatch:\n\n# A workflow run is made up of one or more jobs that can run sequentially or in parallel\njobs:\n  # This workflow contains a single job called \"build\"\n  deploy:\n    # The type of runner that the job will run on\n    runs-on: ubuntu-latest\n\n    # Steps represent a sequence of tasks that will be executed as part of the job\n    steps:\n      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it\n      - uses: actions/checkout@v2\n      - uses: ruby/setup-ruby@v1\n        with:\n          # ruby-version: 3.0.1 # Not needed with a .ruby-version file\n          bundler-cache: true # runs 'bundle install' and caches installed gems automatically\n      - uses: miloserdow/capistrano-deploy@v3 # you can use miloserdow/capistrano-deploy@master for the cuurent stable dev version\n        with:\n          target: development # Defines the environment that will be used for the deployment\n          deploy_key: ${{ secrets.DEPLOY_ENC_KEY }} # Name of the variable configured in Settings/Secrets of your github project\n          enc_rsa_key_pth: config/deploy_id_ed25519_enc\n```\n\n## Example running this action with custom commands\n\nIn this example we are starting rails and Sidekiq with Capistrano\n\n### Personal access token\n\nYou need to create a personal access token with \"repo\" access like described here:\nhttps://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token\n\n### Dispatch workflow\n\nCreate a new dispatch workflow like described here: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#create-a-workflow-dispatch-event\n\n### Workflow file:\n\n```yml\nname: Start Rails and Sidekiq with Capistrano\n\non:\n  workflow_dispatch:\n    inputs:\n      environment:\n        description: \"The environment to deploy\"\n        required: true\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v2\n      - name: Turnstyle\n        uses: softprops/turnstyle@master\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        with:\n          abort-after-seconds: 3600\n      - name: Set up Ruby\n        uses: ruby/setup-ruby@v1\n        with:\n          ruby-version: 2.6.6\n          bundler-cache: true\n      - name: Deploy\n        uses: kaspernj/capistrano-deploy@custom-capistrano-command\n        with:\n          capistrano_commands: '[\"puma:start\", \"sidekiq:start\"]'\n          target: ${{ github.event.inputs.environment }}\n          deploy_key: ${{ secrets.DEPLOY_ENC_KEY }}\n          enc_rsa_key_pth: config/deploy_id_ed25519_enc\n```\n\n### Curl command\n\n```bash\ncurl \\\n  -X POST \\\n  -H \"Accept: application/vnd.github.v3+json\" \\\n  -H \"Authorization: Bearer $PERSONAL_GITHUB_TOKEN\" \\\n  https://api.github.com/repos/$GITHUB_USERNAME/$GITHUB_REPO_NAME/actions/workflows/$WORKFLOW_FILE_NAME/dispatches \\\n  -d \"{\\\"ref\\\":\\\"master\\\",\\\"inputs\\\":{\\\"environment\\\":\\\"$ENVIRONMENT_TO_DEPLOY\\\"}}\"\n```\n\nThis command makes Github start Rails and Sidekiq at the deployment.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiloserdow%2Fcapistrano-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiloserdow%2Fcapistrano-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiloserdow%2Fcapistrano-deploy/lists"}