feat: add environment variables for telemetry configuration #10
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: PR Checks | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout PR 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 make test | |
| run: go test -v ./... | |
| - name: Get PR version | |
| id: pr_version | |
| run: | #shell | |
| # Extract VERSION value from Makefile, remove "v" prefix. | |
| VERSION=$(grep '^VERSION=' Makefile | cut -d'=' -f2) | |
| echo "version=${VERSION#v}" >> $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 | |
| PR_VERSION="${{ steps.pr_version.outputs.version }}" | |
| LATEST_RELEASE_VERSION="${{ steps.latest_release.outputs.version }}" | |
| echo "PR version: $PR_VERSION" | |
| echo "Latest release version: $LATEST_RELEASE_VERSION" | |
| if [ "$PR_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" "$PR_VERSION" "$LATEST_RELEASE_VERSION" | sort -V | tail -n1) | |
| if [ "$LATEST_VERSION" != "$PR_VERSION" ]; then | |
| echo "Error: Makefile VERSION in PR is not greater than the latest release." | |
| exit 1 | |
| fi | |
| echo "Version check passed." |