Merge branch 'grafana:main' into main #3
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: BetterStack Docker Build and Push | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - betterstack-* | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: | |
| - main | |
| env: | |
| IMAGE_NAME: betterstack/beyla | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Apply memory leak fix | |
| run: | | |
| echo "Applying BetterStack memory leak fix..." | |
| patch -p1 < fix-memory-leak-minimal.patch | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to DockerHub | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.IMAGE_NAME }} | |
| tags: | | |
| # For main branch, use 'latest' tag | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| # For version tags, use the version | |
| type=ref,event=tag | |
| # For branches, use branch name | |
| type=ref,event=branch | |
| # SHA prefix for all builds | |
| type=sha,prefix={{branch}}-,format=short | |
| - name: Build and test | |
| run: | | |
| make build | |
| make test | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| VERSION=${{ github.ref_name }} | |
| COMMIT=${{ github.sha }} | |
| - name: Update Docker Hub description | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: peter-evans/dockerhub-description@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| repository: ${{ env.IMAGE_NAME }} | |
| short-description: "BetterStack's fork of Beyla with memory leak fixes" | |
| readme-filepath: ./README_BETTERSTACK.md |