Skip to content

Commit

Permalink
Get/set docker image tag for otelcolarrow from build config
Browse files Browse the repository at this point in the history
  • Loading branch information
T Ratnayake committed Nov 28, 2023
1 parent 02e4e97 commit a8f41be
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
permissions:
contents: read
packages: write
#
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -28,13 +27,21 @@ jobs:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Read build config YAML and read/set otelcol version
id: read-yaml
run: |
# Parse the YAML file and extract the otelcol version
OTELCOL_VERSION=$(yq -r '.dist.otelcol_version' otelcolarrow-build.yaml)
echo "OTELCOL_VERSION=${OTELCOL_VERSION}" >> $GITHUB_ENV
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-EXPERIMENTAL
tags: |
# Set the OTELCOL_VERSION here
echo "::set-output name=otelcol-version-tag::${OTELCOL_VERSION}"
# set latest tag for master branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
Expand All @@ -46,4 +53,4 @@ jobs:
context: ./arrow
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit a8f41be

Please sign in to comment.