Skip to content

Add Logz.io exporter and automated release workflow for OpenTelemetry… #32

Add Logz.io exporter and automated release workflow for OpenTelemetry…

Add Logz.io exporter and automated release workflow for OpenTelemetry… #32

name: "Release Collector Lambda layer"
on:
# (Using tag push instead of release to allow filtering by tag prefix.)
push:
tags:
- layer-collector/**
permissions:
id-token: write
contents: write
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Release
run: gh release create ${{ github.ref_name }} --draft --title ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-layer:
runs-on: ubuntu-latest
needs: create-release
strategy:
matrix:
architecture:
- amd64
- arm64
outputs:
COLLECTOR_VERSION: ${{ steps.save-collector-version.outputs.COLLECTOR_VERSION }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "^1.23.1"
- name: build
run: make -C collector package GOARCH=${{ matrix.architecture }}
- uses: actions/upload-artifact@v4
with:
name: opentelemetry-collector-layer-${{ matrix.architecture }}.zip
path: ${{ github.workspace }}/collector/build/opentelemetry-collector-layer-${{ matrix.architecture }}.zip
- name: Add Binary to Release
run: |
gh release upload ${{github.ref_name}} ${{ github.workspace }}/collector/build/opentelemetry-collector-layer-${{ matrix.architecture }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Save Collector Version
if: ${{ matrix.architecture == 'amd64' }}
id: save-collector-version
shell: bash
# `./collector -v` output is in the form `v0.75.0`
run: |
COLLECTOR_VERSION=$( ${{ github.workspace }}/collector/build/extensions/collector -v)
echo "COLLECTOR_VERSION=$COLLECTOR_VERSION" >> $GITHUB_OUTPUT
publish-layer:
uses: ./.github/workflows/layer-publish.yml
needs: build-layer
strategy:
matrix:
architecture:
- amd64
- arm64
aws_region:
- ap-northeast-1
- ap-northeast-2
- ap-south-1
- ap-southeast-1
- ap-southeast-2
- ca-central-1
- eu-central-1
- eu-north-1
- eu-west-1
- eu-west-2
- eu-west-3
- sa-east-1
- us-east-1
- us-east-2
- us-west-1
- us-west-2
with:
artifact-name: opentelemetry-collector-layer-${{ matrix.architecture }}.zip
layer-name: opentelemetry-collector
component-version: ${{needs.build-layer.outputs.COLLECTOR_VERSION}}
architecture: ${{ matrix.architecture }}
release-group: prod
aws_region: ${{ matrix.aws_region }}
secrets: inherit
update-release:
runs-on: ubuntu-latest
needs:
- publish-layer
- build-layer
steps:
- uses: actions/checkout@v4
- name: Append Layer ARNs to Release Body
run: |
COLLECTOR_VERSION=${{ needs.build-layer.outputs.COLLECTOR_VERSION }}
MESSAGE="### Lambda Layers for OpenTelemetry Collector (${COLLECTOR_VERSION})\n\n"
MESSAGE+="The following Lambda layers are available for this release. Use the appropriate ARN for your Lambda architecture:\n\n"
MESSAGE+="#### 🖥️ **amd64 (x86_64)**\n"
MESSAGE+="\`\`\`\n"
MESSAGE+="arn:aws:lambda:<region>:486140753397:layer:logzio-opentelemetry-collector-amd64-${COLLECTOR_VERSION//./_}:1\n"
MESSAGE+="\`\`\`\n\n"
MESSAGE+="#### 📱 **arm64**\n"
MESSAGE+="\`\`\`\n"
MESSAGE+="arn:aws:lambda:<region>:486140753397:layer:logzio-opentelemetry-collector-arm64-${COLLECTOR_VERSION//./_}:1\n"
MESSAGE+="\`\`\`\n\n"
# Append the message to the release notes
gh release view ${{ github.ref_name }} --json body -q .body > release_body.md
echo -e "\n$MESSAGE" >> release_body.md
gh release edit ${{ github.ref_name }} --notes-file release_body.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}