Skip to content

Alpine Linux 3.20

Alpine Linux 3.20 #341

Workflow file for this run

name: build
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- 'master'
- 'releases/*'
tags:
- '*'
paths-ignore:
- '**.md'
pull_request:
branches:
- 'master'
- 'releases/*'
paths-ignore:
- '**.md'
env:
DOCKERHUB_SLUG: crazymax/alpine-s6
GHCR_SLUG: ghcr.io/crazy-max/alpine-s6
DOCKERHUB_DIST_SLUG: crazymax/alpine-s6-dist
GHCR_DIST_SLUG: ghcr.io/crazy-max/alpine-s6-dist
ALPINE_LATEST: 3.20
jobs:
build:
strategy:
fail-fast: false
matrix:
alpine_version:
- '3.15'
- '3.16'
- '3.17'
- '3.18'
- '3.19'
- '3.20'
- 'edge'
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Prepare
run: |
NL=$'\n'
ALPINE_VERSION=${{ matrix.alpine_version }}
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
VERSION=${TAG%-r*}
fi
IMAGE_TAGS=""
if [[ $ALPINE_VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3} ]]; then
IMAGE_TAGS="${IMAGE_TAGS}${ALPINE_VERSION}-${VERSION}${NL}"
if [ "$ALPINE_VERSION" = "${{ env.ALPINE_LATEST }}" ]; then
IMAGE_TAGS="${IMAGE_TAGS}latest-${VERSION}${NL}"
fi
else
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3} ]]; then
IMAGE_TAGS="${IMAGE_TAGS}${ALPINE_VERSION}-${VERSION}${NL}"
else
IMAGE_TAGS="${IMAGE_TAGS}${VERSION}${NL}"
fi
fi
if [ "$VERSION" != "edge" ]; then
IMAGE_TAGS="${IMAGE_TAGS}${ALPINE_VERSION}${NL}"
if [ "$ALPINE_VERSION" = "${{ env.ALPINE_LATEST }}" ]; then
IMAGE_TAGS="${IMAGE_TAGS}latest${NL}"
fi
fi
echo "IMAGE_TAGS<<EOF" >> $GITHUB_ENV
echo -e "$IMAGE_TAGS" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.DOCKERHUB_SLUG }}
${{ env.GHCR_SLUG }}
tags: ${{ env.IMAGE_TAGS }}
labels: |
org.opencontainers.image.title=alpine-s6
org.opencontainers.image.description=Alpine Linux with s6 overlay
org.opencontainers.image.vendor=CrazyMax
-
name: Docker meta dist
id: meta_dist
uses: docker/metadata-action@v5
with:
images: |
${{ env.DOCKERHUB_DIST_SLUG }}
${{ env.GHCR_DIST_SLUG }}
tags: ${{ env.IMAGE_TAGS }}
labels: |
org.opencontainers.image.title=alpine-s6-dist
org.opencontainers.image.description=s6 overlay
org.opencontainers.image.vendor=CrazyMax
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-config-inline: |
[worker.oci]
max-parallelism = 4
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build artifacts
uses: docker/bake-action@v4
with:
targets: artifact-all
pull: true
provenance: false
env:
ALPINE_VERSION: ${{ matrix.alpine_version }}
-
name: Move artifacts
if: matrix.alpine_version == env.ALPINE_LATEST
run: |
mv ./dist/**/* ./dist/
-
name: Upload artifacts
if: matrix.alpine_version == env.ALPINE_LATEST
uses: actions/upload-artifact@v3
with:
name: s6-overlay
path: ./dist/*
if-no-files-found: error
-
name: Build image
uses: docker/bake-action@v4
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
targets: image-all
push: ${{ github.event_name != 'pull_request' }}
env:
ALPINE_VERSION: ${{ matrix.alpine_version }}
-
name: Build dist
uses: docker/bake-action@v4
with:
files: |
./docker-bake.hcl
${{ steps.meta_dist.outputs.bake-file }}
targets: image-dist-all
pull: true
push: ${{ github.event_name != 'pull_request' }}
env:
ALPINE_VERSION: ${{ matrix.alpine_version }}
-
name: GitHub Release
uses: softprops/action-gh-release@v2
if: matrix.alpine_version == env.ALPINE_LATEST && startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: |
dist/*.tar.gz
dist/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Check manifest
if: github.event_name != 'pull_request'
run: |
docker buildx imagetools inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}
-
name: Check pull
if: github.event_name != 'pull_request'
run: |
docker pull ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker image inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker pull ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}
docker image inspect ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}