container #335
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: container | |
on: | |
schedule: | |
- cron: "0 10 * * *" | |
push: | |
branches: | |
- "main" | |
tags: | |
- "[0-9]+.*.*" | |
jobs: | |
container: | |
name: container | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [ ubuntu, debian ] | |
codename: [ latest ] | |
include: | |
- os: ubuntu | |
codename: noble | |
- os: ubuntu | |
codename: jammy | |
- os: ubuntu | |
codename: focal | |
- os: debian | |
codename: bullseye | |
- os: debian | |
codename: buster | |
steps: | |
- name: fixup variables | |
id: var-fixup | |
run: | | |
if test "${{ matrix.os }}" = "debian"; then | |
echo "CONTAINER=rust" >> $GITHUB_ENV | |
else | |
echo "CONTAINER=${{ matrix.os }}" >> $GITHUB_ENV | |
fi || true | |
if test "${{ matrix.codename }}" = "latest"; then | |
echo "TAG_SUFFIX=${{ matrix.os }}" >> $GITHUB_ENV | |
else | |
echo "TAG_SUFFIX=${{ matrix.codename }}" >> $GITHUB_ENV | |
fi || true | |
if test "${{ matrix.os }}" = "debian" -a "${{ matrix.codename }}" = "latest"; then | |
echo "LATEST=true" >> $GITHUB_ENV | |
else | |
echo "LATEST=false" >> $GITHUB_ENV | |
fi || true | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
ghcr.io/kaspar030/git-cache | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}},latest={{ env.LATEST }} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
flavor: | | |
latest=auto | |
prefix= | |
suffix=-${{ env.TAG_SUFFIX }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ci/docker | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
DEBIAN_FROM=${{ env.CONTAINER }}:${{ matrix.codename }} | |
SOURCE=--git https://github.com/${{ github.repository }} --rev ${{ github.sha }} |