Skip to content

try with context

try with context #8

Workflow file for this run

name: CI
on:
push:
branches: [ "main", "fresh" ]
env:
agru: "v0.1.12"
alpine: "3.20"
ansible: "10.3.0"
ansible_core: "2.17.3"
permissions:
checks: write
contents: write
packages: write
pull-requests: read
jobs:
# build-base:
# name: Build base image
# runs-on: ubuntu-latest
# if: ${{ github.ref == 'refs/heads/fresh' }}
# steps:
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1
# - name: Login to ghcr.io
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ghcr.io/${{ github.repository }}/base
# tags: |
# type=raw,value=${{ env.alpine }}-${{ env.ansible_core }}-${{ env.ansible }},enable=${{ github.ref_name == 'fresh' }}
# - name: Build and push
# uses: docker/build-push-action@v6
# with:
# platforms: linux/amd64,linux/arm64
# file: Dockerfile.base
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
# build-args: |
# AGRU=${{ env.agru }}
# ALPINE=${{ env.alpine }}
# ANSIBLE=${{ env.ansible }}
# ANSIBLE_CORE=${{ env.ansible_core }}
build-fresh:
name: Build ansible image (fresh)
# needs: build-base
runs-on: self-hosted
if: ${{ github.ref == 'refs/heads/fresh' }}
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
registry.etke.cc/${{ github.repository }}
tags: |
type=raw,value=fresh,enable=${{ github.ref_name == 'fresh' }}
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
AGRU=${{ env.agru }}
ALPINE=${{ env.alpine }}
ANSIBLE=${{ env.ansible }}
ANSIBLE_CORE=${{ env.ansible_core }}
build-stable:
name: Build ansible image (stable)
runs-on: self-hosted
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
registry.etke.cc/${{ github.repository }}
tags: |
type=raw,value=latest,enable=${{ github.ref_name == 'main' }}
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
AGRU=${{ env.agru }}
ALPINE=${{ env.alpine }}
ANSIBLE=${{ env.ansible }}
ANSIBLE_CORE=${{ env.ansible_core }}