Add tar (#28) #104
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: Docker Images Builder | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
env: | |
DH_IMAGE_BASE_NAME: alvrme/alpine-android-base | |
DH_IMAGE_NAME: alvrme/alpine-android | |
GHCR_IMAGE_BASE_NAME: alvr/alpine-android-base | |
GHCR_IMAGE_NAME: alvr/alpine-android | |
QUAY_IMAGE_BASE_NAME: alvr/alpine-android-base | |
QUAY_IMAGE_NAME: alvr/alpine-android | |
DOCKERHUB_USER: alvrme | |
QUAY_USER: alvr | |
DEFAULT_JDK_VERSION: 11 | |
LATEST_STABLE_API: 33 | |
jobs: | |
build_base_images: | |
name: Build Alpine Android Base Image | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
jdk: [8, 11, 17] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set environment variables | |
shell: sh | |
run: | | |
set -eu | |
case ${{ matrix.jdk }} in | |
8) | |
CMDLINE_VERSION="8.0" | |
SDK_TOOLS_VERSION="9123335" ;; | |
11) | |
CMDLINE_VERSION="10.0" | |
SDK_TOOLS_VERSION="9862592" ;; | |
17) | |
CMDLINE_VERSION="11.0" | |
SDK_TOOLS_VERSION="10406996" ;; | |
esac | |
echo "CMDLINE_VERSION=${CMDLINE_VERSION}" >> $GITHUB_ENV | |
echo "SDK_TOOLS_VERSION=${SDK_TOOLS_VERSION}" >> $GITHUB_ENV | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
${{ env.DH_IMAGE_BASE_NAME }} | |
ghcr.io/${{ env.GHCR_IMAGE_BASE_NAME }} | |
quay.io/${{ env.QUAY_IMAGE_BASE_NAME }} | |
tags: | | |
type=raw,value=jdk${{ matrix.jdk }} | |
type=raw,value=latest-jdk${{ matrix.jdk }} | |
type=raw,value=latest,enable=${{ matrix.jdk == env.DEFAULT_JDK_VERSION }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ env.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_PASS }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GHCR_PASS }} | |
- name: Login to Quay | |
uses: docker/login-action@v2 | |
with: | |
registry: quay.io | |
username: ${{ env.QUAY_USER }} | |
password: ${{ secrets.QUAY_PASS }} | |
- name: Build Android Base JDK${{ matrix.jdk }} | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./docker | |
file: ./docker/base.Dockerfile | |
push: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
JDK_VERSION=${{ matrix.jdk }} | |
CMDLINE_VERSION=${{ env.CMDLINE_VERSION }} | |
SDK_TOOLS_VERSION=${{ env.SDK_TOOLS_VERSION }} | |
build_images: | |
name: Build Alpine Android Image | |
needs: [build_base_images] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
android-api: [28, 29, 30, 31, 32, 33, 34] | |
jdk: [8, 11, 17] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set environment variables | |
shell: sh | |
run: | | |
set -eu | |
case ${{ matrix.android-api }} in | |
28) BUILD_TOOLS_VERSION="28.0.3" ;; | |
29) BUILD_TOOLS_VERSION="29.0.3" ;; | |
30) BUILD_TOOLS_VERSION="30.0.3" ;; | |
31) BUILD_TOOLS_VERSION="31.0.0" ;; | |
32) BUILD_TOOLS_VERSION="32.0.0" ;; | |
33) BUILD_TOOLS_VERSION="33.0.2" ;; | |
34) BUILD_TOOLS_VERSION="34.0.0" ;; | |
esac | |
echo "BUILD_TOOLS_VERSION=$BUILD_TOOLS_VERSION" >> $GITHUB_ENV | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
${{ env.DH_IMAGE_NAME }} | |
ghcr.io/${{ env.GHCR_IMAGE_NAME }} | |
quay.io/${{ env.QUAY_IMAGE_NAME }} | |
tags: | | |
type=raw,value=android-${{ matrix.android-api }}-jdk${{ matrix.jdk }} | |
type=raw,value=android-${{ matrix.android-api }}-jdk${{ matrix.jdk }}-${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
type=raw,value=android-${{ matrix.android-api }},enable=${{ matrix.jdk == env.DEFAULT_JDK_VERSION }} | |
type=raw,value=latest-jdk${{ matrix.jdk }},enable=${{ matrix.android-api == env.LATEST_STABLE_API }} | |
type=raw,value=latest,enable=${{ matrix.android-api == env.LATEST_STABLE_API && matrix.jdk == env.DEFAULT_JDK_VERSION }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ env.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_PASS }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GHCR_PASS }} | |
- name: Login to Quay | |
uses: docker/login-action@v2 | |
with: | |
registry: quay.io | |
username: ${{ env.QUAY_USER }} | |
password: ${{ secrets.QUAY_PASS }} | |
- name: Build Android API ${{ matrix.android-api }} JDK${{ matrix.jdk }} | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./docker | |
file: ./docker/android.Dockerfile | |
push: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
JDK_VERSION=${{ matrix.jdk }} | |
BUILD_TOOLS=${{ env.BUILD_TOOLS_VERSION }} | |
TARGET_SDK=${{ matrix.android-api }} |