Skip to content
name: "Release Collector Lambda layer"
on:
push:
branches:
- main
- feature/EIM-3431-UpdateGithubActions
permissions:
id-token: write
contents: write
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
lfs: true
- name: Get the last tag
id: get_last_tag
run: |
cd ${{ github.workspace }}
pwd
git describe --tags
echo "bum"
last_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "::set-output name=last_tag::$last_tag"
# The following 10 lines of code were human modified suggestions given by GitHub Copilot
- name: Increment tag version
id: increment_tag
run: |
last_tag=${{ steps.get_last_tag.outputs.last_tag }}
prefix=$(echo $last_tag | cut -d'/' -f1)
major_minor=$(echo $last_tag | cut -d'/' -f2 | cut -d'.' -f1,2)
patch=$(echo $last_tag | cut -d'.' -f3)
x=$(echo $major_minor | cut -d'.' -f2)
new_x=$((x + 1))
new_tag="$prefix/0.$new_x.1"
echo "::set-output name=new_tag::$new_tag"
- name: Create Release
run: gh release create --title ${{ steps.increment_tag.outputs.new_tag }} --generate-notes
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
# Commented out since we don't publish the layer to AWS now
# 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