Skip to content

Commit 9a52065

Browse files
authored
fix: remove use_ssh flag (#65)
BREAKING CHANGE: Remove `use_ssh`. Documentation is in place to deploy using SSH keys
1 parent cd3c00a commit 9a52065

File tree

4 files changed

+43
-15
lines changed

4 files changed

+43
-15
lines changed

‎Dockerfile‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ RUN set -eux; \
66
gpg \
77
alpine-sdk \
88
bash \
9-
openssh \
109
libffi-dev \
1110
;
1211
COPY entrypoint.sh /entrypoint.sh

‎README.md‎

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ jobs:
6666
6767
| Name | Description | Default |
6868
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
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` |
69+
| `github_token` | Token for the repo. Can be passed in using `${{secrets.GITHUB_TOKEN }}`. Required if `push: true` | - |
7170
| `dry_run` | Run without creating commit, output to stdout | false |
7271
| `repository` | Repository name to push. Default or empty value represents current github repository | current one |
7372
| `branch` | Destination branch to push changes | Same as the one executing the action by default |
@@ -119,11 +118,49 @@ jobs:
119118
uses: actions/checkout@v3
120119
with:
121120
fetch-depth: 0
122-
ssh-key: '${{secrets.COMMIT_KEY }}'
121+
ssh-key: "${{secrets.COMMIT_KEY }}"
123122
- name: Create bump and changelog
124123
uses: commitizen-tools/commitizen-action@master
125124
with:
126-
use_ssh: true
125+
push: false
126+
- name: Push using ssh
127+
run: |
128+
git push origin main --tags
129+
```
130+
131+
## Creating a Github release
132+
133+
```yaml
134+
name: Bump version
135+
136+
on:
137+
push:
138+
branches:
139+
- main
140+
141+
jobs:
142+
bump-version:
143+
if: "!startsWith(github.event.head_commit.message, 'bump:')"
144+
runs-on: ubuntu-latest
145+
name: "Bump version and create changelog with commitizen"
146+
steps:
147+
- name: Check out
148+
uses: actions/checkout@v3
149+
with:
150+
fetch-depth: 0
151+
token: "${{secrets.PERSONAL_ACCESS_TOKEN }}"
152+
- name: Create bump and changelog
153+
uses: commitizen-tools/commitizen-action@master
154+
with:
155+
github_token: ${{secrets.PERSONAL_ACCESS_TOKEN }}
156+
changelog_increment_filename: body.md
157+
- name: Release
158+
uses: softprops/action-gh-release@v1
159+
with:
160+
body_path: "body.md"
161+
tag_name: ${{env.REVISION }}
162+
env:
163+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN }}
127164
```
128165

129166
## Troubleshooting

‎action.yml‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ inputs:
3737
github_token:
3838
description: 'Token for the repo. Can be passed in using $\{{secrets.GITHUB_TOKEN }}'
3939
required: false
40-
use_ssh:
41-
description: 'Set to true if ssh-key has been configured for the actions/checkout'
42-
required: false
43-
default: "false"
4440
repository:
4541
description: 'Repository name to push. Default or empty value represents current github repository (${GITHUB_REPOSITORY})'
4642
default: ''

‎entrypoint.sh‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ set -e
66
gpg --version
77
git --version
88

9-
if [[ -z$INPUT_GITHUB_TOKEN&&$INPUT_USE_SSH!="true" ]];then
10-
echo'Missing input "github_token: ${{secrets.GITHUB_TOKEN }}" or "use_ssh", choose one.'>&2
9+
if [[ -z$INPUT_GITHUB_TOKEN&&$INPUT_PUSH=="true" ]];then
10+
echo'Missing input "github_token: ${{secrets.GITHUB_TOKEN }}" which is required to push.'>&2
1111
exit 1
1212
fi
1313

@@ -92,10 +92,6 @@ if [[ $INPUT_PUSH == 'true' ]]; then
9292
if [[ $INPUT_MERGE!='true'&&$GITHUB_EVENT_NAME=='pull_request' ]];then
9393
echo"Refusing to push on pull_request event since that would merge the pull request.">&2
9494
echo"You probably want to run on push to your default branch instead.">&2
95-
elif [[ $INPUT_USE_SSH=="true" ]];then
96-
echo"Pushing to branch using SSH..."
97-
REMOTE_REPO="[email protected]:${INPUT_REPOSITORY}.git"
98-
git push "$REMOTE_REPO""HEAD:${INPUT_BRANCH}" --tags
9995
else
10096
echo"Pushing to branch..."
10197
REMOTE_REPO="https://${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@github.com/${INPUT_REPOSITORY}.git"

0 commit comments

Comments
(0)