Create core module release #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create core module release | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
sprintVersion: | |
required: true | |
type: string | |
description: The sprint version, excluding the patch version, e.g. 1.245 | |
jobs: | |
create-release: | |
# Only allow creating new releases from the main branch. | |
if: github.ref_name == 'main' | |
runs-on: ubuntu-latest | |
steps: | |
# Will check out the branch, update version.go, and create a new branch and tag. | |
# E.g. if the sprint version is 1.245, it will: | |
# - create a branch named release/1.245.x | |
# - set the "Version" string constant to "1.245.1" | |
# - create a tag named v1.245.1 | |
- uses: actions/checkout@v3 | |
- name: Create release branch and tag | |
# Assign the Action sprintVersion input to the SPRINT_VERSION environment variable. | |
env: | |
# The name of the release branch, which is the sprint version appended with a .x suffix, e.g. 1.245.x | |
SPRINT_VERSION: ${{ format('{0}{1}', inputs.sprintVersion, '.x') }} | |
# The full version including patch number, starting at 1 for a new release, e.g. 1.245.1 | |
SPRINT_VERSION_WITH_PATCH: ${{ format('{0}{1}', inputs.sprintVersion, '.1') }} | |
run: | | |
[[ ${{ inputs.sprintVersion }} ]] || { echo "Required input sprintVersion not set, exiting."; exit 1; } | |
git config user.name github-actions[bot] | |
git config user.email github-actions[bot]@users.noreply.github.com | |
git config push.autoSetupRemote true | |
git checkout -b release/$SPRINT_VERSION | |
sh update_version.sh | |
git add . | |
git commit -m "Release $SPRINT_VERSION_WITH_PATCH" | |
git tag -a core/v$SPRINT_VERSION_WITH_PATCH -m "Release $SPRINT_VERSION_WITH_PATCH" | |
git push --follow-tags | |
# Update the Go modules index so that "go get github.com/dynatrace-oss/opentelemetry-exporter-go/core" | |
# will resolve to the latest tag. | |
# Users may install a specific version, e.g. "go get github.com/dynatrace-oss/opentelemetry-exporter-go/[email protected]" | |
- uses: actions/setup-go@v3 | |
- name: Update Go modules index | |
env: | |
SPRINT_VERSION_WITH_PATCH: ${{ format('{0}{1}', inputs.sprintVersion, '.1') }} | |
run: GOPROXY=proxy.golang.org go list -m github.com/dynatrace-oss/opentelemetry-exporter-go/core@v$SPRINT_VERSION_WITH_PATCH |