Skip to content
name: publish splunk-otel-dotnet operator docker image to ghcr
on:
release:
types: [published]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-22.04
permissions:
packages: write
contents: read
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- uses: docker/[email protected]
- name: Get the latest release version
run: |
if [[ "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.x$ ]]; then
# get the latest tag on the release branch
RELEASE_VERSION="$(git describe --abbrev=0)"
elif [[ "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
RELEASE_VERSION="$GITHUB_REF_NAME"
else
echo "This script can only be run on the tag or a release branch"
exit 1
fi
echo RELEASE_VERSION=${RELEASE_VERSION} >> $GITHUB_ENV
- name: Set the major version number
run: echo MAJOR_VERSION=${GITHUB_REF_NAME} | sed -e 's/\..*//' >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build and publish container
uses: docker/[email protected]
with:
push: true
file: Dockerfile
platforms: linux/amd64
build-args: |
RELEASE_VER=${{ env.RELEASE_VERSION }}
tags: |
ghcr.io/signalfx/splunk-otel-dotnet/splunk-otel-dotnet:latest
ghcr.io/signalfx/splunk-otel-dotnet/splunk-otel-dotnet:${{ env.MAJOR_VERSION }}
ghcr.io/signalfx/splunk-otel-dotnet/splunk-otel-dotnet:${{ env.RELEASE_VERSION }}