Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle tag templates for package versions and output EVG link #50

Merged
merged 5 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compliance-report/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ if [ -n "$EVERGREEN_PROJECT" ]; then
# Format evergreen patch URL.
EVERGREEN_PROJECT=$(echo $EVERGREEN_PROJECT | sed 's/-/_/g')
EVERGREEN_PATCH="Evergreen patch: https://spruce.mongodb.com/version/${EVERGREEN_PROJECT}_${EVERGREEN_COMMIT}"
echo $EVERGREEN_PATCH >> $GITHUB_STEP_SUMMARY
fi

cat << EOF >> ${S3_ASSETS}/ssdlc_compliance_report.txt
Expand Down
12 changes: 11 additions & 1 deletion python/pre-publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ inputs:
version_bump_script:
description: The version bump script
default: hatch version
tag_template:
description: The template for the git tag
default: "${VERSION}"
tag_message_template:
description: The template for the git tag message
default: "Release ${VERSION}"
working_directory:
description: The working directory for the action
default: "."
Expand Down Expand Up @@ -50,6 +56,8 @@ runs:
uses: mongodb-labs/drivers-github-tools/tag-version@v2
with:
version: ${{ inputs.version }}
tag_template: ${{ inputs.tag_template }}
tag_message_template: ${{ inputs.tag_message_template }}
push_tag: ${{ env.PUSH_CHANGES }}
- name: Handle version
shell: bash
Expand All @@ -58,5 +66,7 @@ runs:
if [ "${{ inputs.dry_run}}" == 'true' ]; then
echo "version=${{ github.ref }}" >> $GITHUB_OUTPUT
else
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
export VERSION=${{ inputs.version }}
export TAG=$(echo "${{ inputs.tag_template }}" | envsubst)
echo "version=$TAG" >> $GITHUB_OUTPUT
fi
4 changes: 4 additions & 0 deletions python/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ inputs:
working_directory:
description: The working directory for the action
default: "."
tag_template:
description: The template for the git tag
default: "${VERSION}"
token:
description: The GitHub access token
dry_run:
Expand Down Expand Up @@ -74,6 +77,7 @@ runs:
env:
GH_TOKEN: ${{ inputs.token }}
VERSION: ${{ inputs.version }}
TAG_TEMPLATE: ${{ inputs.tag_template }}
PRODUCT_NAME: ${{ inputs.product_name }}
DRY_RUN: ${{ inputs.dry_run }}
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#publishing-the-distribution-to-pypi
Expand Down
7 changes: 4 additions & 3 deletions python/publish/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ if [ "$DRY_RUN" == "false" ]; then
PUSH_CHANGES=true
echo "Creating draft release with attached files"
TITLE="${PRODUCT_NAME} ${VERSION}"
gh release create ${VERSION} --draft --verify-tag --title "${TITLE}" --notes "Community notes: <link>"
gh release upload ${VERSION} $RELEASE_ASSETS/*.*
TAG=$(echo "${TAG_TEMPLATE}" | envsubst)
gh release create ${TAG} --draft --verify-tag --title "${TITLE}" --notes "Community notes: <link>"
gh release upload ${TAG} $RELEASE_ASSETS/*.*
JSON="url,tagName,assets,author,createdAt"
JQ='.url,.tagName,.author.login,.createdAt,.assets[].name'
echo "\## $TITLE" >> $GITHUB_STEP_SUMMARY
gh release view --json $JSON --jq $JQ ${VERSION} >> $GITHUB_STEP_SUMMARY
gh release view --json $JSON --jq $JQ ${TAG} >> $GITHUB_STEP_SUMMARY
else
echo "Dry run, not creating GitHub Release" >> $GITHUB_STEP_SUMMARY
ls -ltr $RELEASE_ASSETS
Expand Down
Loading