feat: move feature gates and set to be defined at startup level (#45) #180
This file contains 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: otlpinf-release | |
on: | |
push: | |
branches: [ "main" ] | |
schedule: | |
- cron: '0 0 * * 1' | |
permissions: | |
packages: write | |
contents: write | |
jobs: | |
check: | |
outputs: | |
release: ${{ steps.early.outputs.release }} | |
runs-on: ubuntu-latest | |
steps: | |
- id: early | |
name: New version check | |
run: | | |
OTEL_LATEST_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/open-telemetry/opentelemetry-collector-releases/releases/latest) | |
OTEL_LATEST_VERSION=$(echo $OTEL_LATEST_RELEASE | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/') | |
INF_LATEST_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/netboxlabs/opentelemetry-infinity/releases/latest) | |
INF_LATEST_VERSION=$(echo $INF_LATEST_RELEASE | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/') | |
release='' | |
if [[ $OTEL_LATEST_VERSION != $INF_LATEST_VERSION ]]; then | |
release=$OTEL_LATEST_VERSION | |
fi | |
echo "release=$release" >> $GITHUB_OUTPUT | |
release: | |
runs-on: ubuntu-latest | |
needs: check | |
if: needs.check.outputs.release != '' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Version | |
env: | |
RELEASE: ${{needs.check.outputs.release}} | |
run: | | |
echo "LAST_TAG=`git tag --sort=committerdate | tail -1`" >> $GITHUB_ENV | |
echo "TAG=$RELEASE" >> $GITHUB_ENV | |
echo "ARTIFACT_VERSION=${RELEASE:1}" >> $GITHUB_ENV | |
ARTIFACT="otelcol-contrib_${ARTIFACT_VERSION}_linux_amd64.tar.gz" | |
ARTIFACT_URL="https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/$RELEASE/$ARTIFACT" | |
mkdir .temp/ | |
wget -O .temp/otelcol-contrib.tar.gz $ARTIFACT_URL | |
tar -xvzf .temp/otelcol-contrib.tar.gz -C .temp/ | |
mv .temp/otelcol-contrib runner/ | |
rm -rf .temp/ | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
- name: Build Binary | |
run: make build | |
- name: Unit Tests | |
run: make test | |
- name: Zip files | |
run: | | |
zip -j otlpinf-amd64.zip build/otlpinf | |
zip -j otelcol-contrib-amd64.zip runner/otelcol-contrib | |
- name: Download and zip arm64 | |
run: | | |
ARTIFACT="otelcol-contrib_${{ env.ARTIFACT_VERSION }}_linux_arm64.tar.gz" | |
ARTIFACT_URL="https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/$RELEASE/$ARTIFACT" | |
mkdir .temp/ | |
wget -O .temp/otelcol-contrib.tar.gz $ARTIFACT_URL | |
tar -xvzf .temp/otelcol-contrib.tar.gz -C .temp/ | |
zip -j otelcol-contrib-arm64.zip .temp/otelcol-contrib | |
rm -rf .temp/ | |
- name: Generate release changelog | |
run: | | |
echo "# What's new" > changelog.md | |
git log ${{ env.LAST_TAG }}..HEAD --pretty=format:"$ad- %s [%an]" >> changelog.md | |
sed -i -e "s/- /• /g" changelog.md | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.TAG }} | |
body_path: ./changelog.md | |
files: | | |
otlpinf-amd64.zip | |
otelcol-contrib-amd64.zip | |
otelcol-contrib-arm64.zip | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf #v3.2.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 #v3.8.0 | |
- name: Login to Docker Hub | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 #v3.3.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build image and push | |
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 #v6.10.0 | |
with: | |
context: . | |
file: docker/Dockerfile | |
platforms: linux/amd64, linux/arm64 | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: | | |
netboxlabs/opentelemetry-infinity:latest | |
netboxlabs/opentelemetry-infinity:${{ env.TAG }} |