|
49 | 49 | name: "Bump version and create changelog with commitizen"
|
50 | 50 | steps:
|
51 | 51 | - name: Check out
|
52 |
| - uses: actions/checkout@v2 |
| 52 | + uses: actions/checkout@v3 |
53 | 53 | with:
|
54 | 54 | fetch-depth: 0
|
55 | 55 | token: "${{ secrets.GITHUB_TOKEN }}"
|
|
66 | 66 |
|
67 | 67 | | Name | Description | Default |
|
68 | 68 | | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
|
69 |
| -| `github_token` | Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}` **required** | - | |
| 69 | +| `github_token` | Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}`. Required if `use_ssh: false` | - | |
| 70 | +| `use_ssh` | Set to true if ssh-key has been configured for the `actions/checkout` | `false` | |
70 | 71 | | `dry_run` | Run without creating commit, output to stdout | false |
|
71 | 72 | | `repository` | Repository name to push. Default or empty value represents current github repository | current one |
|
72 | 73 | | `branch` | Destination branch to push changes | Same as the one executing the action by default |
|
|
94 | 95 |
|
95 | 96 | The new version is also available as an environment variable under `REVISION` or you can access using `${{ steps.cz.outputs.version }}`
|
96 | 97 |
|
| 98 | +## Using SSH with deploy keys |
| 99 | + |
| 100 | +1. Create a [deploy key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/managing-deploy-keys#deploy-keys) (which is the SSH **public key**) |
| 101 | +2. Add the **private key** as a [Secret](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) in your repository, e.g: `COMMIT_KEY` |
| 102 | +3. Set up your action |
| 103 | + |
| 104 | +```yaml |
| 105 | +name: Bump version |
| 106 | +
|
| 107 | +on: |
| 108 | + push: |
| 109 | + branches: |
| 110 | + - main |
| 111 | +
|
| 112 | +jobs: |
| 113 | + bump-version: |
| 114 | + if: "!startsWith(github.event.head_commit.message, 'bump:')" |
| 115 | + runs-on: ubuntu-latest |
| 116 | + name: "Bump version and create changelog with commitizen" |
| 117 | + steps: |
| 118 | + - name: Check out |
| 119 | + uses: actions/checkout@v3 |
| 120 | + with: |
| 121 | + fetch-depth: 0 |
| 122 | + ssh-key: '${{ secrets.COMMIT_KEY }}' |
| 123 | + - name: Create bump and changelog |
| 124 | + uses: commitizen-tools/commitizen-action@master |
| 125 | + with: |
| 126 | + use_ssh: true |
| 127 | +``` |
| 128 | + |
97 | 129 | ## Troubleshooting
|
98 | 130 |
|
99 | 131 | ### Other actions are not triggered when the tag is pushed
|
|
0 commit comments