Add OpenTelemetry autoexport support and clean up metrics handling #7
Workflow file for this run
This file contains hidden or 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: Promote | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - main | |
| jobs: | |
| promote: | |
| if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout main branch | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| - name: Setup Go | |
| uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@0a35821d5c230e903fcfe077583637dea1b27b47 # v9.0.0 | |
| with: | |
| version: v2.6.2 | |
| - name: Run Go Tests | |
| run: go test -v ./... | |
| - name: Get branch version | |
| id: branch_version | |
| run: | #shell | |
| # Extract VERSION value from Makefile. | |
| VERSION=$(grep '^VERSION=' Makefile | cut -d'=' -f2) | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| - name: Get latest release version | |
| id: latest_release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | #shell | |
| # Fetch latest release tag, remove "v" prefix. | |
| # If no release exists, default to 0.0.0 to allow the first version to be published. | |
| LATEST_TAG=$(gh release view --json tagName --jq .tagName 2>/dev/null || echo "v0.0.0") | |
| echo "version=${LATEST_TAG#v}" >> $GITHUB_OUTPUT | |
| - name: Compare versions | |
| run: | #shell | |
| BRANCH_VERSION_RAW="${{ steps.branch_version.outputs.version }}" | |
| BRANCH_VERSION="${BRANCH_VERSION_RAW#v}" | |
| LATEST_RELEASE_VERSION="${{ steps.latest_release.outputs.version }}" | |
| echo "Branch version: $BRANCH_VERSION" | |
| echo "Latest release version: $LATEST_RELEASE_VERSION" | |
| if [ "$BRANCH_VERSION" = "$LATEST_RELEASE_VERSION" ]; then | |
| echo "Error: Makefile VERSION in PR is the same as the latest release." | |
| exit 1 | |
| fi | |
| # Using sort -V for version comparison | |
| LATEST_VERSION=$(printf "%s\n%s" "$BRANCH_VERSION" "$LATEST_RELEASE_VERSION" | sort -V | tail -n1) | |
| if [ "$LATEST_VERSION" != "$BRANCH_VERSION" ]; then | |
| echo "Error: Makefile VERSION in branch is not greater than the latest release." | |
| exit 1 | |
| fi | |
| echo "Version check passed." | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ steps.branch_version.outputs.version }} | |
| name: Release ${{ steps.branch_version.outputs.version }} | |
| body: | | |
| ${{ github.event.pull_request.title }} | |
| ${{ github.event.pull_request.body }} | |
| See PR: ${{ github.event.pull_request.html_url }} | |
| draft: false | |
| prerelease: false |