Skip to content

Docker arm64 (#14)

Docker arm64 (#14) #19

Workflow file for this run

on:
push:
tags:
- 'v*'
name: Handle Release
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
- name: Get tag version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Build Asset (linux/amd64)
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.Version=${{ steps.get_version.outputs.VERSION }}'" -o bin/prometheus-aws-discovery-linux-amd64 ./cmd/prometheus-aws-discovery/...
- name: Build Asset (darwin/amd64)
run: CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-X 'main.Version=${{ steps.get_version.outputs.VERSION }}'" -o bin/prometheus-aws-discovery-darwin-amd64 ./cmd/prometheus-aws-discovery/...
- name: Build Asset (linux/arm64)
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-X 'main.Version=${{ steps.get_version.outputs.VERSION }}'" -o bin/prometheus-aws-discovery-linux-arm64 ./cmd/prometheus-aws-discovery/...
- name: Build Asset (darwin/arm64)
run: CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="-X 'main.Version=${{ steps.get_version.outputs.VERSION }}'" -o bin/prometheus-aws-discovery-darwin-arm64 ./cmd/prometheus-aws-discovery/...
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
body: |
Build also available as docker image:
`daspawnw/prometheus-aws-discovery:${{ steps.get_version.outputs.VERSION }}`
- name: Upload Release Asset (linux/amd64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: bin/prometheus-aws-discovery-linux-amd64
asset_name: prometheus-aws-discovery-linux-amd64
asset_content_type: application/x-executable
- name: Upload Release Asset (darwin/amd64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: bin/prometheus-aws-discovery-darwin-amd64
asset_name: prometheus-aws-discovery-darwin-amd64
asset_content_type: application/x-mach-binary
- name: Upload Release Asset (linux/arm64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: bin/prometheus-aws-discovery-linux-arm64
asset_name: prometheus-aws-discovery-linux-arm64
asset_content_type: application/x-executable
- name: Upload Release Asset (darwin/arm64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: bin/prometheus-aws-discovery-darwin-arm64
asset_name: prometheus-aws-discovery-darwin-arm64
asset_content_type: application/x-mach-binary
docker:
name: Docker Push (GHCR & public ECR)
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
packages: write
needs: Release
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Set output
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Docker publish
uses: daspawnw/docker-multi-build-push-action@master
with:
platforms: "linux/amd64,linux/arm64"
docker-tag: "${{ steps.vars.outputs.tag }}"
ghcr-enabled: "true"
ghcr-token: "${{ secrets.GITHUB_TOKEN }}"
ecr-enabled: "true"
ecr-role-to-assume: "${{ secrets.AWS_PUBLIC_ECR_ARN }}"
ecr-repository-url: "public.ecr.aws/l2l6k4u5/prometheus-aws-discovery"