Skip to content

Commit 0fa2b89

Browse files
committed
feat(git): added commit signing + resetting of configured commiter after script run
1 parent 3c547ef commit 0fa2b89

File tree

6 files changed

+19
-0
lines changed

6 files changed

+19
-0
lines changed

.env.dist

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
GH_COMMITER_NAME=openswoole-bundle-bot
2+
GH_COMMITER_EMAIL=147276322+openswoole-bundle-bot@users.noreply.github.com
3+
GH_COMMITER_SIGNING_KEY=xxxx
4+
GH_TOKEN=xxxx
5+
DRY_RUN="0"
6+
DEBUG="1"
7+
GH_RELEASE_DRAFT="false"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ENV CURRENT_VERSION="" \
1010
GH_REPOSITORY="openswoole-bundle/release-version-script" \
1111
GH_COMMITER_NAME="openswoole-bundle-bot" \
1212
GH_COMMITER_EMAIL="147276322+openswoole-bundle-bot@users.noreply.github.com" \
13+
GH_COMMITER_SIGNING_KEY="xxxx" \
1314
GH_TOKEN="" \
1415
GH_RELEASE_DRAFT="false" \
1516
GH_RELEASE_PRERELEASE="false"

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ https://hub.docker.com/r/openswoolebundle/release-version-script
99
```sh
1010
docker-compose build --pull
1111

12+
# either export vars to shell or use .env file
13+
export GH_COMMITER_SIGNING_KEY=xxxx
1214
export GH_TOKEN="xxxxx"
1315
export DRY_RUN="0"
1416
export DEBUG="1"

docker-compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ services:
1313
GH_REPOSITORY: "${GH_REPOSITORY:-openswoole-bundle/release-version-script}"
1414
GH_COMMITER_NAME: "${GH_COMMITER_NAME:-openswoole-bundle-bot}"
1515
GH_COMMITER_EMAIL: "${GH_COMMITER_EMAIL:-147276322+openswoole-bundle-bot@users.noreply.github.com}"
16+
GH_COMMITER_SIGNING_KEY: "${GH_COMMITER_SIGNING_KEY:-xxxx}"
1617
GH_TOKEN: "${GH_TOKEN:-xxxxxxxx}"
1718
GH_RELEASE_DRAFT: "${GH_RELEASE_DRAFT:-true}"
1819
GH_RELEASE_PRERELEASE: "${GH_RELEASE_PRERELEASE:-false}"

release-version.sh

+7
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@ fi
2525
# Set GH env variables
2626
GH_COMMITER_NAME="${GH_COMMITER_NAME:-openswoole-bundle-bot}"
2727
GH_COMMITER_EMAIL="${GH_COMMITER_EMAIL:-147276322+openswoole-bundle-bot@users.noreply.github.com}"
28+
GH_COMMITER_SIGNING_KEY="${GH_COMMITER_SIGNING_KEY:-xxxx}"
2829
GH_REPOSITORY="${GH_REPOSITORY:-openswoole-bundle/swoole-bundle}"
2930
GH_TOKEN="${GH_TOKEN:?"Provide \"GH_TOKEN\" variable with GitHub Personal Access Token"}"
3031

3132
# Configure git
3233
git config user.name "${GH_COMMITER_NAME}"
3334
git config user.email "${GH_COMMITER_EMAIL}"
35+
git config user.signingkey "${GH_COMMITER_SIGNING_KEY}"
36+
git config commit.gpgsign true
3437

3538
GIT_COMMIT_MESSAGE_FIRST_LINE="$(git show-branch --no-name HEAD)"
3639
GIT_COMMIT_MESSAGE_RELEASE_COMMIT_MATCHED="$(echo "$GIT_COMMIT_MESSAGE_FIRST_LINE" | sed -E 's/^chore\(release\)\: v([a-zA-Z0-9\.\-]+) \:tada\:/\1/')"
@@ -244,5 +247,9 @@ git push origin $PR_BASE
244247
fi
245248
done
246249
git remote remove authorized
250+
git config --unset user.name
251+
git config --unset user.email
252+
git config --unset user.signingkey
253+
git config --unset commit.gpgsign
247254

248255
echo "Please approve and fast-forward merge release pull requests!"

0 commit comments

Comments
 (0)