Skip to content

chore(deps): update reviewdog/action-actionlint action to v1.57.0 #518

chore(deps): update reviewdog/action-actionlint action to v1.57.0

chore(deps): update reviewdog/action-actionlint action to v1.57.0 #518

Workflow file for this run

name: Build Container Image
on:
push:
branches:
- main
tags:
- v*
pull_request:
jobs:
rust_version:
runs-on: ubuntu-latest
outputs:
rust_version: ${{ steps.rust_ver.outputs.rust_version }}
steps:
- uses: actions/checkout@v4
- name: Get Rust version
id: rust_ver
run: |
echo "rust_version="$(awk -F'[ ="]+' '$1 == "channel" { print $2 }' rust-toolchain) >> $GITHUB_OUTPUT
echo ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
build_and_push:
name: Build and Push
needs: rust_version
strategy:
fail-fast: false
matrix:
base_img: [buster, slim-buster, slim, bullseye, slim-bullseye]
arch: [amd64, arm64, i686]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5.5.1
with:
images: |
ghcr.io/${{ github.repository }},enable=true
sksat/${{ github.event.repository.name }},enable=true
flavor: |
latest=auto
suffix=-${{ needs.rust_version.outputs.rust_version }}-${{ matrix.base_img }},onlatest=false
suffix=-${{ matrix.base_img }},onlatest=true
tags: |
type=sha
type=ref,event=pr
type=raw,value=${{ needs.rust_version.outputs.rust_version }},enable={{is_default_branch}}
- name: Set up Earthly
uses: earthly/actions-setup@v1.0.13
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Login to ghcr.io
uses: docker/login-action@v3.3.0
if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v3.3.0
if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
with:
username: sksat
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set Tag
id: tags
run: |
TAGS_META=$(cat <<EOF
${{ steps.meta.outputs.tags }}
EOF
)
echo "tags from meta: ${TAGS_META}"
TAGS="${TAGS_META}"
if ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}; then
echo "add remove default branch version tags"
for t in ${TAGS_META}; do
TAGS=$(echo -e "${TAGS}\n$(echo $t | sed 's/${{ github.event.repository.default_branch }}-//')")
done
fi
echo "tags: ${TAGS}"
TAGS="${TAGS//'%'/'%25'}"
TAGS="${TAGS//$'\n'/'%0A'}"
TAGS="${TAGS//$'\r'/'%0D'}"
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
- name: Build & Push container image
env:
EARTHLY_PUSH: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
EARTHLY_REMOTE_CACHE: ghcr.io/sksat/cargo-chef-docker:cache-${{ matrix.base_img }}-${{ matrix.arch }}
run: |
earthly \
+docker-${{ matrix.arch }} \
--BASE_TAG="${{ needs.rust_version.outputs.rust_version }}-${{ matrix.base_img }}" --DOCKER_META_VERSION=${{ steps.meta.outputs.version }}
- name: Set docker tag alias
uses: ./.github/actions/action-docker-alias
with:
push: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
image: ghcr.io/sksat/cargo-chef-docker:${{ needs.rust_version.outputs.rust_version }}-${{ matrix.base_img }}-${{ steps.meta.outputs.version }}
tags_json: ${{ steps.meta.outputs.json }}
tag_suffix: ${{ (matrix.arch != 'amd64' && matrix.arch) || '' }}
- name: Check image
run: |
docker image ls
- name: Test image
if: ${{ matrix.arch == 'amd64' }}
run: |
docker run --rm ghcr.io/sksat/cargo-chef-docker:${{ needs.rust_version.outputs.rust_version }}-${{ matrix.base_img }}-${{ steps.meta.outputs.version }} cargo chef --version