Skip to content

Commit

Permalink
Minor improvements to bump and tag actions (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus authored Jun 13, 2024
1 parent e796a48 commit 7edc545
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
17 changes: 9 additions & 8 deletions bump-version/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ inputs:
required: true
version_bump_script:
description: The version bump script
required: true
default: ''
commit_template:
description: The template for the git commit message
default: "BUMP ${VERSION}"
Expand All @@ -21,26 +21,27 @@ runs:
using: composite
steps:
- name: Set new version
if: ${{ inputs.version_bump_script != '' }}
shell: bash -eux {0}
run: |
${{ inputs.version_bump_script }} ${{ inputs.version }}
- name: Get the commit message
shell: bash -eux {0}
run: |
export VERSION=${{inputs.version}}
export COMMIT_MESSAGE=$(echo "${{inputs.commit_template}}" | envsubst)
export VERSION=${{ inputs.version }}
export COMMIT_MESSAGE=$(echo "${{ inputs.commit_template }}" | envsubst)
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> $GITHUB_ENV
- name: Commit the version bump
uses: mongodb-labs/drivers-github-tools/git-sign@v2
with:
command: git commit -a -m \"${{env.COMMIT_MESSAGE}}\" -s --gpg-sign=${{ env.GPG_KEY_ID }}
artifactory_image: ${{inputs.artifactory_image}}
command: git commit -a -m \"${{ env.COMMIT_MESSAGE }}\" -s --gpg-sign=${{ env.GPG_KEY_ID }}
artifactory_image: ${{ inputs.artifactory_image }}
- name: Push the commit to the source branch
shell: bash -eux {0}
run: |
if [ ${{ inputs.push_commit }} == "true" ]; then
git push origin
echo "### Pushed version bump: ${{inputs.version}}" >> $GITHUB_STEP_SUMMARY
echo "Pushed version bump: ${{ inputs.version }}" >> $GITHUB_STEP_SUMMARY
else
echo "### Created version bump (no push): ${{inputs.version}}" >> $GITHUB_STEP_SUMMARY
fi
echo "Created version bump (no push): ${{ inputs.version }}" >> $GITHUB_STEP_SUMMARY
fi
16 changes: 8 additions & 8 deletions tag-version/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ inputs:
default: "${VERSION}"
tag_message_template:
description: The template for the git tag message
default: "BUMP ${VERSION}"
default: "Release ${VERSION}"
push_tag:
description: Whether to push the tag
default: "true"
Expand All @@ -23,14 +23,14 @@ runs:
- name: Get the tag
shell: bash -eux {0}
run: |
export VERSION=${{inputs.version}}
export TAG=$(echo "${{inputs.tag_template}}" | envsubst)
export VERSION=${{ inputs.version }}
export TAG=$(echo "${{ inputs.tag_template }}" | envsubst)
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Get the tag message
shell: bash -eux {0}
run: |
export VERSION=${{inputs.version}}
export TAG_MESSAGE=$(echo "${{inputs.tag_message_template}}" | envsubst)
export VERSION=${{ inputs.version }}
export TAG_MESSAGE=$(echo "${{ inputs.tag_message_template }}" | envsubst)
echo "TAG_MESSAGE=$TAG_MESSAGE" >> $GITHUB_ENV
- name: Tag the version
uses: mongodb-labs/drivers-github-tools/git-sign@v2
Expand All @@ -52,7 +52,7 @@ runs:
run: |
if [ ${{ inputs.push_tag }} == "true" ]; then
git push origin --tags
echo "### Pushed tag: ${{inputs.version}}" >> $GITHUB_STEP_SUMMARY
echo "Pushed tag: ${{ inputs.version }}" >> $GITHUB_STEP_SUMMARY
else
echo "### Created tag (no push): ${{inputs.version}}" >> $GITHUB_STEP_SUMMARY
fi
echo "Created tag (no push): ${{ inputs.version }}" >> $GITHUB_STEP_SUMMARY
fi

0 comments on commit 7edc545

Please sign in to comment.