Skip to content

Commit

Permalink
changes on the github action
Browse files Browse the repository at this point in the history
  • Loading branch information
e-n-0 committed Sep 30, 2024
1 parent 1ef1070 commit 4134743
Showing 1 changed file with 55 additions and 4 deletions.
59 changes: 55 additions & 4 deletions .github/workflows/service-extensions-publish.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
name: Publish Service Extensions Callout images packages

# on push in the PR branch
on:
push:
branches:
- 'flavien/service-extensions'
release:
types:
- published
workflow_dispatch:
inputs:
tag_name:
description: 'Docker image tag to use for the package'
required: true
default: 'dev'
commit_sha:
description: 'Commit SHA to checkout'
required: true

permissions:
contents: read
Expand All @@ -14,8 +25,32 @@ jobs:
publish-service-extensions:
runs-on: ubuntu-latest
steps:

- name: Get tag name
id: get_tag_name
run: |
if [ "${{ github.event_name }}" = "release" ]; then
echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_ENV"
else
if [ -z "${{ github.event.inputs.tag_name }}" ]; then
echo "tag=dev" >> "$GITHUB_ENV"
else
echo "tag=${{ github.event.inputs.tag_name }}" >> "$GITHUB_ENV"
echo "Setting tag to: ${{ github.event.inputs.tag_name }}"
fi
fi
- name: Checkout
uses: actions/checkout@v4
if: github.event_name == 'release'
with:
ref: ${{ steps.get_tag_name.outputs.tag }}

- name: Checkout
uses: actions/checkout@v4
if: github.event_name != 'release'
with:
ref: ${{ github.event.inputs.commit_sha || github.sha }}

- name: Set up Go 1.22
uses: actions/setup-go@v5
Expand All @@ -33,13 +68,29 @@ jobs:
shell: bash
run: docker login -u publisher -p ${{ secrets.GITHUB_TOKEN }} ghcr.io

- name: Build and push
- name: Build and push [dev]
id: build-dev
if: github.event_name != 'release'
uses: docker/build-push-action@v6
with:
context: .
file: ./contrib/envoyproxy/envoy/cmd/serviceextensions/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/datadog/dd-trace-go/service-extensions-callout:latest,ghcr.io/datadog/dd-trace-go/service-extensions-callout:${{ github.sha }}

tags: | # Use the commit SHA from the manual trigger or default to the SHA from the push event
ghcr.io/datadog/dd-trace-go/service-extensions-callout:${{ steps.get_tag_name.outputs.tag }}
ghcr.io/datadog/dd-trace-go/service-extensions-callout:${{ github.event.inputs.commit_sha || github.sha }}
- name: Build and push [release]
id: build-release
if: github.event_name == 'release'
uses: docker/build-push-action@v6
with:
context: .
file: ./contrib/envoyproxy/envoy/cmd/serviceextensions/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/datadog/dd-trace-go/service-extensions-callout:latest
ghcr.io/datadog/dd-trace-go/service-extensions-callout:${{ steps.get_tag_name.outputs.tag }}
ghcr.io/datadog/dd-trace-go/service-extensions-callout:${{ github.sha }}

0 comments on commit 4134743

Please sign in to comment.