Skip to content

feat: add python

feat: add python #72

name: Docker
on:
push:
branches:
- gcc/*
env:
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/caentainer-gcc
jobs:
push:
runs-on: self-hosted
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- name: Generate Image Tag
id: image-tag
run: |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[ "$VERSION" == "main" ] && VERSION=latest
echo VERSION=$VERSION
echo "TAG=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ steps.image-tag.outputs.TAG }},enable=true,priority=900
type=ref,event=branch
type=ref,event=tag
- name: Log into GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ fromJSON(steps.meta.outputs.json).tags[0] }}-buildcache
cache-to: type=registry,ref=${{ fromJSON(steps.meta.outputs.json).tags[0] }}-buildcache,mode=max
platforms: linux/amd64
build-args: |
GITHUB_SERVER_URL=${{ github.server_url }}
GITHUB_REPOSITORY=${{ github.repository }}