Skip to content

Commit

Permalink
Replace existing release GitHub workflow with a reusable version that…
Browse files Browse the repository at this point in the history
… adds ARM support

Signed-off-by: Dom Del Nano <[email protected]>
  • Loading branch information
ddelnano committed Nov 21, 2023
1 parent 1162a49 commit f2fcd00
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 42 deletions.
64 changes: 24 additions & 40 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,28 @@
name: Release

---
on:
release:
types: [prereleased, released]
# Disable prereleased trigger since that requires opting into including the Helm chart
# in this repository.
# types: [prereleased, released]
types: [released]
tags:
- 'v*'
workflow_dispatch:

jobs:
release-docker:
name: Release docker & config
runs-on: ubuntu-latest
env:
DOCKER_IMAGE_NAME: newrelic/newrelic-pixie-integration
steps:
- name: Generate docker image version from git tag
run: |
DOCKER_IMAGE_TAG=$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//')
echo "DOCKER_IMAGE_TAG=$DOCKER_IMAGE_TAG" >> $GITHUB_ENV
- name: Validate git and docker tag format
run: |
echo "${{ github.event.release.tag_name }}" | grep -E '^v[0-9.]*[0-9]$'
echo "$DOCKER_IMAGE_TAG" | grep -E '^[0-9.]*[0-9]$'
- if: ${{ github.event.release.prerelease }}
run: |
echo "DOCKER_IMAGE_TAG=$DOCKER_IMAGE_TAG-pre" >> $GITHUB_ENV
- uses: actions/checkout@v3

- name: Build container image
run: |
make all
- uses: docker/login-action@v2
with:
username: ${{ secrets.FSI_DOCKERHUB_USERNAME }}
password: ${{ secrets.FSI_DOCKERHUB_TOKEN }}
- name: Push docker image
run: |
docker push "$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG"
- name: Tag and push docker :latest image
if: ${{ ! github.event.release.prerelease }}
run: |
docker tag $DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG $DOCKER_IMAGE_NAME:latest
docker push "$DOCKER_IMAGE_NAME:latest"
release-integration:
permissions:
contents: write
pull-requests: write
uses: newrelic/k8s-metadata-injection/.github/workflows/release-integration-reusable.yml@main
with:
repo_name: newrelic-pixie-integration
artifact_path: bin/
docker_image_name: newrelic/newrelic-pixie-integration
chart_directory: "REQUIRED_BUT_NOT_USED"
secrets:
dockerhub_username: ${{ secrets.FSI_DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.FSI_DOCKERHUB_TOKEN }}
bot_token: "REQUIRED_BUT_NOT_USED"
slack_channel: ${{ secrets.SLACK_CHANNEL }}
slack_token: ${{ secrets.SLACK_TOKEN }}
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM golang:1.20-alpine as builder
FROM --platform=${BUILDPLATFORM} golang:1.20-alpine as builder

ARG TARGETOS TARGETARCH

RUN mkdir newrelic-pixie-integration
WORKDIR newrelic-pixie-integration
Expand All @@ -11,7 +13,7 @@ COPY go.sum .
RUN go mod download

COPY . ./
RUN go build -o /usr/bin/newrelic-pixie-integration cmd/main.go
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /usr/bin/newrelic-pixie-integration cmd/main.go


FROM alpine:3.18.2
Expand Down

0 comments on commit f2fcd00

Please sign in to comment.