Skip to content

v0.0.48

v0.0.48 #56

name: Release Container Image
on:
release:
types:
- published
env:
NAME: "azad-kube-proxy"
jobs:
push-container:
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v3
- name: Prepare
id: prep
run: |
VERSION=sha-${GITHUB_SHA::8}
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF/refs\/tags\//}
fi
echo BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') >> $GITHUB_OUTPUT
echo VERSION=${VERSION} >> $GITHUB_OUTPUT
- name: Get GitHub Tag
id: get_tag
run: |
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Cache container layers
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push container (multi arch)
uses: docker/[email protected]
with:
push: true
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: ghcr.io/xenitab/${{ env.NAME }}:${{ steps.get_tag.outputs.tag }}
build-args: |
VERSION=${{ steps.prep.outputs.VERSION }}
REVISION=${{ github.sha }}
CREATED=${{ steps.prep.outputs.BUILD_DATE }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
- name: Check images
run: |
docker buildx imagetools inspect ghcr.io/xenitab/${{ env.NAME }}:${{ steps.get_tag.outputs.tag }}
docker pull ghcr.io/xenitab/${{ env.NAME }}:${{ steps.get_tag.outputs.tag }}