diff --git a/golang/pre-publish/action.yml b/golang/pre-publish/action.yml index d2ec3cb..5f747e6 100644 --- a/golang/pre-publish/action.yml +++ b/golang/pre-publish/action.yml @@ -11,13 +11,19 @@ inputs: runs: using: composite steps: + - name: Set up environment + shell: bash + run: + bash ${{ github.action_path }}/set-environment.sh + env: + VERSION: "${{ inputs.version }}" - uses: mongodb-labs/drivers-github-tools/bump-version@v2 with: version: ${{ inputs.version }} version_bump_script: "go run ${{ github.action_path }}/bump-version.go" - commit_template: "BUMP v${VERSION}" + commit_template: "${{ env.COMMIT_TEMPLATE }}" push_commit: ${{ inputs.push_changes }} - uses: mongodb-labs/drivers-github-tools/tag-version@v2 with: - version: v${{ inputs.version }} + version: "${{ env.TAG_VERSION }}" push_tag: ${{ inputs.push_changes }} \ No newline at end of file diff --git a/golang/pre-publish/set-environment.sh b/golang/pre-publish/set-environment.sh new file mode 100644 index 0000000..5a8d50f --- /dev/null +++ b/golang/pre-publish/set-environment.sh @@ -0,0 +1,13 @@ +#! /bin/bash +set -eu + +COMMIT_TEMPLATE='BUMP v${VERSION}' +TAG_VERSION="v${VERSION}" + +if [[ "${VERSION}" =~ ^cloud.* ]]; then + COMMIT_TEMPLATE='BUMP ${VERSION}' + TAG_VERSION="${VERSION}" +fi + +echo "COMMIT_TEMPLATE=$COMMIT_TEMPLATE" >> $GITHUB_ENV +echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV \ No newline at end of file