Skip to content

publish-collector-agent #49

publish-collector-agent

publish-collector-agent #49

name: publish-collector-agent
on:
release:
types: [created]
workflow_dispatch:
permissions:
contents: write
packages: write
env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}/collector-agent
TAG_NAME: 0.7.1
jobs:
collector-agent:
# reference from https://docs.docker.com/build/ci/github-actions/multi-platform/
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v7
push: true
tags: ${{ env.REGISTRY_IMAGE }}:${{ env.TAG_NAME }}
# collector-agent:
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# platform:
# - linux/amd64
# - linux/arm/v6
# - linux/arm/v7
# - linux/arm64
# steps:
# - name: Prepare
# run: |
# platform=${{ matrix.platform }}
# echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
# - name: Docker meta
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ env.REGISTRY_IMAGE }}
# flavor: |
# latest = false
# tags: ${{ env.TAG_NAME }}
# - uses: actions/checkout@v2
# with:
# submodules: "true"
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Build and push by digest
# id: build
# uses: docker/build-push-action@v5
# with:
# context: collector-agent
# platforms: ${{ matrix.platform }}
# github-token: ${{ secrets.GITHUB_TOKEN }}
# labels: ${{ steps.meta.outputs.labels }}
# outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
# - name: Export digest
# run: |
# mkdir -p /tmp/digests
# digest="${{ steps.build.outputs.digest }}"
# touch "/tmp/digests/${digest#sha256:}"
# - name: Upload digest
# uses: actions/upload-artifact@v4
# with:
# name: digests-${{ env.PLATFORM_PAIR }}
# path: /tmp/digests/*
# if-no-files-found: error
# retention-days: 1
# merge:
# runs-on: ubuntu-latest
# needs:
# - collector-agent
# steps:
# - name: Download digests
# uses: actions/download-artifact@v4.1.7
# with:
# path: /tmp/digests
# pattern: digests-*
# merge-multiple: true
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Docker meta
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ env.REGISTRY_IMAGE }}
# flavor: |
# latest = false
# tags: ${{ env.TAG_NAME }}
# - name: Login to Docker Hub
# uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Create manifest list and push
# working-directory: /tmp/digests
# run: |
# set -x
# docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
# $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
# - name: Inspect image
# run: |
# docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ env.TAG_NAME }}
Release-Collector-agent:
runs-on: ubuntu-latest
if: github.event_name == 'release'
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
goos: [linux, windows]
goarch: [amd64]
steps:
- name: Show environment
run: export
- uses: actions/checkout@v2
- uses: wangyoucao577/go-release-action@v1
id: release-ca
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goversion: 1.19
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
project_path: "collector-agent"
binary_name: "collector-agent"
extra_files: LICENSE collector-agent/CHANGES.md
ldflags: -X "github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/server.Version=${{ env.TAG_NAME }}"