mirror of
https://github.com/kerberos-io/agent.git
synced 2026-10-23 18:18:24 +00:00
121 lines
5.6 KiB
YAML
121 lines
5.6 KiB
YAML
name: Create a new release
|
|
on:
|
|
release:
|
|
types: [created]
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "Tag for the Docker image"
|
|
required: true
|
|
default: "test"
|
|
|
|
env:
|
|
REPO: kerberos/agent
|
|
|
|
jobs:
|
|
build-amd64:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
strategy:
|
|
matrix:
|
|
architecture: [amd64]
|
|
steps:
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- uses: benjlevesque/short-sha@v2.1
|
|
id: short-sha
|
|
with:
|
|
length: 7
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
- name: Available platforms
|
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
|
- name: Run Buildx
|
|
run: docker buildx build --platform linux/$(echo ${{matrix.architecture}} | tr - /) -t $REPO-arch:arch-${{matrix.architecture}}-${{github.event.inputs.tag || github.ref_name}} --push .
|
|
- name: Create new and append to manifest
|
|
run: docker buildx imagetools create -t $REPO:${{ github.event.inputs.tag || github.ref_name }} $REPO-arch:arch-${{matrix.architecture}}-${{github.event.inputs.tag || github.ref_name}}
|
|
- name: Create new and append to manifest latest
|
|
run: docker buildx imagetools create -t $REPO:latest $REPO-arch:arch-${{matrix.architecture}}-${{github.event.inputs.tag || github.ref_name}}
|
|
if: github.event.inputs.tag == 'test'
|
|
- name: Run Buildx with output
|
|
run: docker buildx build --platform linux/$(echo ${{matrix.architecture}} | tr - /) -t $REPO-arch:arch-$(echo ${{matrix.architecture}} | tr / -)-${{github.event.inputs.tag || github.ref_name}} --output type=tar,dest=output-${{matrix.architecture}}.tar .
|
|
- name: Strip binary
|
|
run: mkdir -p output/ && tar -xf output-${{matrix.architecture}}.tar -C output && rm output-${{matrix.architecture}}.tar && cd output/ && tar -cf ../agent-${{matrix.architecture}}.tar -C home/agent . && rm -rf output
|
|
- name: Create a release
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
latest: true
|
|
allowUpdates: true
|
|
name: ${{ github.event.inputs.tag || github.ref_name }}
|
|
tag: ${{ github.event.inputs.tag || github.ref_name }}
|
|
generateReleaseNotes: false
|
|
omitBodyDuringUpdate: true
|
|
artifacts: "agent-${{matrix.architecture}}.tar"
|
|
# Taken from GoReleaser's own release workflow.
|
|
# The available Snapcraft Action has some bugs described in the issue below.
|
|
# The mkdirs are a hack for https://github.com/goreleaser/goreleaser/issues/1715.
|
|
#- name: Setup Snapcraft
|
|
# run: |
|
|
# sudo apt-get update
|
|
# sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft
|
|
# mkdir -p $HOME/.cache/snapcraft/download
|
|
# mkdir -p $HOME/.cache/snapcraft/stage-packages
|
|
#- name: Use Snapcraft
|
|
# run: tar -xf agent-${{matrix.architecture}}.tar && snapcraft
|
|
build-other:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
needs: build-amd64
|
|
strategy:
|
|
matrix:
|
|
architecture: [arm64, arm-v7, arm-v6]
|
|
#architecture: [arm64, arm-v7]
|
|
steps:
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- uses: benjlevesque/short-sha@v2.1
|
|
id: short-sha
|
|
with:
|
|
length: 7
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
- name: Available platforms
|
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
|
- name: Run Buildx
|
|
run: docker buildx build --platform linux/$(echo ${{matrix.architecture}} | tr - /) -t $REPO-arch:arch-${{matrix.architecture}}-${{github.event.inputs.tag || github.ref_name}} --push .
|
|
- name: Create new and append to manifest
|
|
run: docker buildx imagetools create --append -t $REPO:${{ github.event.inputs.tag || github.ref_name }} $REPO-arch:arch-${{matrix.architecture}}-${{github.event.inputs.tag || github.ref_name}}
|
|
- name: Create new and append to manifest latest
|
|
run: docker buildx imagetools create --append -t $REPO:latest $REPO-arch:arch-${{matrix.architecture}}-${{github.event.inputs.tag || github.ref_name}}
|
|
if: github.event.inputs.tag == 'test'
|
|
- name: Run Buildx with output
|
|
run: docker buildx build --platform linux/$(echo ${{matrix.architecture}} | tr - /) -t $REPO-arch:arch-$(echo ${{matrix.architecture}} | tr / -)-${{github.event.inputs.tag || github.ref_name}} --output type=tar,dest=output-${{matrix.architecture}}.tar .
|
|
- name: Strip binary
|
|
run: mkdir -p output/ && tar -xf output-${{matrix.architecture}}.tar -C output && rm output-${{matrix.architecture}}.tar && cd output/ && tar -cf ../agent-${{matrix.architecture}}.tar -C home/agent . && rm -rf output
|
|
- name: Create a release
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
latest: true
|
|
allowUpdates: true
|
|
name: ${{ github.event.inputs.tag || github.ref_name }}
|
|
tag: ${{ github.event.inputs.tag || github.ref_name }}
|
|
generateReleaseNotes: false
|
|
omitBodyDuringUpdate: true
|
|
artifacts: "agent-${{matrix.architecture}}.tar"
|