Skip to content

refactor: deployment revisions #132

refactor: deployment revisions

refactor: deployment revisions #132

Workflow file for this run

name: Build agent
on:
push:
branches:
- 'main'
tags:
- '*'
pull_request:
jobs:
build-agent:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
agent:
- docker-agent
- kubernetes-agent
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Generate commit hash
id: generate
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Docker Metadata
id: meta
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
with:
images: ghcr.io/glasskube/cloud/${{ matrix.agent }}
tags: |
type=ref,event=branch
type=sha,event=branch
type=semver,pattern={{version}}
labels: |
org.opencontainers.image.description=Agent software for the Glasskube Cloud Software Distribution Platform
org.opencontainers.image.vendor=Glasskube
- name: Docker build (push only for tag)
uses: docker/build-push-action@b32b51a8eda65d6793cd0494a773d4f6bcef32dc # v6.11.0
with:
file: Dockerfile.${{ matrix.agent }}
build-args: |
COMMIT=${{ steps.generate.outputs.sha_short }}
VERSION=${{ github.ref_name }}
push: ${{ startsWith(github.ref, 'refs/tags/') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}