Skip to content

Commit de9a496

Browse files
committed
Use bump and tag actions from drivers-github-tools
1 parent c53c215 commit de9a496

File tree

3 files changed

+23
-38
lines changed

3 files changed

+23
-38
lines changed

.github/workflows/commit-and-tag.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,29 @@ jobs:
9393
# Preliminary checks done - commence the release process
9494
#
9595

96-
# This step creates the "Package x.y.z" commit that will be the base of
97-
# our tag and creates the release tag. This is run inside the container in
98-
# order to create signed git artifacts
99-
- name: "Create package commit and release tag"
100-
uses: mongodb-labs/drivers-github-tools/git-sign@v2
96+
- name: "Create package commit"
97+
uses: mongodb-labs/drivers-github-tools/bump-version@v2
10198
with:
102-
command: "$(pwd)/.github/workflows/commit-and-tag.sh ${{ inputs.version }} ${{ env.GPG_KEY_ID }}"
103-
104-
# This step needs to happen outside of the container, as PHP is not
105-
# available within.
106-
- name: "Bump to next development release"
107-
run: ./bin/update-release-version.php to-next-patch-dev
99+
version: ${{ inputs.version }}
100+
# Use get-version as a dummy as a version_bump_script is required
101+
# We run the bump script manually earlier so we can sanity-check the version number and print nice output
102+
version_bump_script: "./bin/update-release-version.php get-version"
103+
commit_template: 'Package ${VERSION}'
104+
# Don't push changes as we're creating a second commit later
105+
push_commit: false
106+
107+
- name: "Create release tag"
108+
uses: mongodb-labs/drivers-github-tools/tag-version@v2
109+
with:
110+
version: ${{ inputs.version }}
111+
tag_message_template: 'Release ${VERSION}'
108112

109-
# Create a signed "back to -dev" commit, again inside the container
110-
- name: "Create dev commit"
111-
uses: mongodb-labs/drivers-github-tools/git-sign@v2
113+
- name: "Bump to next development release and commit"
114+
uses: mongodb-labs/drivers-github-tools/bump-version@v2
112115
with:
113-
command: "git commit -m 'Back to -dev' -s --gpg-sign=${{ env.GPG_KEY_ID }} phongo_version.h"
116+
version: ${{ inputs.version }}
117+
version_bump_script: "./bin/update-release-version.php to-next-patch-dev"
118+
commit_template: 'Back to -dev'
114119

115120
# TODO: Manually merge using ours strategy. This avoids merge-up pull requests being created
116121
# Process is:
@@ -119,9 +124,6 @@ jobs:
119124
# 3. push next branch
120125
# 4. switch back to release branch, then push
121126

122-
- name: "Push changes from release branch"
123-
run: git push
124-
125127
- name: "Prepare release message"
126128
run: |
127129
cat > release-message <<'EOL'
@@ -131,9 +133,6 @@ jobs:
131133
- name: "Create draft release"
132134
run: echo "RELEASE_URL=$(gh release create ${{ inputs.version }} --target ${{ github.ref_name }} --title "${{ inputs.version }}" --notes-file release-message --draft)" >> "$GITHUB_ENV"
133135

134-
- name: "Push release tag"
135-
run: git push origin ${{ inputs.version }}
136-
137136
- name: "Set summary"
138137
run: |
139138
echo '🚀 Created tag and drafted release for version [${{ inputs.version }}](${{ env.RELEASE_URL }})' >> $GITHUB_STEP_SUMMARY

bin/update-release-version.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ function get_next_minor_version(array $versions): array
140140
];
141141
}
142142

143-
if ($argc !== 2) {
143+
// Allow 2 arguments as the bump-version action always passes a version number, even when not needed
144+
if (! in_array($argc, [2, 3])) {
144145
usage();
145146
}
146147

@@ -149,6 +150,7 @@ function get_next_minor_version(array $versions): array
149150
switch ($argv[1] ?? null) {
150151
case 'get-version':
151152
echo $currentVersion['version'];
153+
152154
exit(0);
153155

154156
case 'to-stable':
@@ -170,4 +172,3 @@ function get_next_minor_version(array $versions): array
170172
write_release_version(VERSION_FILENAME, $newVersion);
171173

172174
printf("Updated version number in version file from %s to %s\n", $currentVersion['version'], $newVersion['version']);
173-

0 commit comments

Comments
 (0)