Skip to content

chore(deps): update peter-evans/dockerhub-description action to v4 (#… #245

chore(deps): update peter-evans/dockerhub-description action to v4 (#…

chore(deps): update peter-evans/dockerhub-description action to v4 (#… #245

on:
push:
branches:
- main
paths:
- .github/workflows/build_push_image.yml
- Dockerfile
- config/version.json
- script/docker-entrypoint.sh
- script/set_environment_variables.sh
- test/**
workflow_dispatch:
jobs:
build_push_android:
permissions:
packages: write
contents: read
runs-on: ubuntu-22.04
env:
IMAGE_REPOSITORY_NAME: flutter-android
ANDROID_BUILD_TOOLS_VERSION: 30.0.3
VERSION_MANIFEST: config/version.json
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Login to Quay.io
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: Read environment variables from version.json
env:
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
run: ./script/set_environment_variables.sh
- name: Set environment variable for image repository and tag
run: |
IMAGE_REPOSITORY_PATH="${{ github.repository_owner }}/${{ env.IMAGE_REPOSITORY_NAME }}"
echo "IMAGE_REPOSITORY_PATH=$IMAGE_REPOSITORY_PATH" >> $GITHUB_ENV
- name: Load image metadata
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5
id: metadata
with:
images: |
${{ env.IMAGE_REPOSITORY_PATH }}
ghcr.io/${{ env.IMAGE_REPOSITORY_PATH }}
quay.io/${{ env.IMAGE_REPOSITORY_PATH }}
tags: |
type=raw,value=${{ env.FLUTTER_VERSION }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3
- name: Build image and push to local Docker daemon
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
with:
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
target: android
build-args: |
flutter_version=${{ env.FLUTTER_VERSION }}
fastlane_version=${{ env.FASTLANE_VERSION }}
android_build_tools_version=${{ env.ANDROID_BUILD_TOOLS_VERSION }}
android_platform_versions=${{ env.ANDROID_PLATFORM_VERSIONS }}
- name: Record image in Docker Scout environment
id: docker-scout-environment
uses: docker/scout-action@v1
with:
command: environment
# Use the Docker Hub image that is the first tag in the metadata
image: registry://${{ fromJson(steps.metadata.outputs.json).tags[0] }}
environment: prod
organization: ${{ secrets.DOCKER_HUB_USERNAME }}
- name: Test image
uses: plexsystems/container-structure-test-action@c0a028aa96e8e82ae35be556040340cbb3e280ca # v0.3.0
with:
image: ${{ fromJSON(steps.metadata.outputs.json).tags[0] }}
config: test/android.yml
- name: Build image and push it to registries
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
with:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
labels: ${{ steps.metadata.outputs.labels }}
tags: ${{ steps.metadata.outputs.tags }}
target: android
build-args: |
flutter_version=${{ env.FLUTTER_VERSION }}
fastlane_version=${{ env.FASTLANE_VERSION }}
android_build_tools_version=${{ env.ANDROID_BUILD_TOOLS_VERSION }}
android_platform_versions=${{ env.ANDROID_PLATFORM_VERSIONS }}
- name: Update Docker Hub description
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ env.IMAGE_REPOSITORY_PATH }}
short-description: ${{ github.event.repository.description }}
readme-filepath: readme.md
# TODO: Use kaniko for building and pushing after slowness is solved
# TODO: https://github.com/GoogleContainerTools/kaniko/issues/970
# TODO: https://github.com/GoogleContainerTools/kaniko/issues/875
# TODO: Use kaniko for building and pushing after pushing to Docker daemon is solved, to be able to test Docker image, with the following issues
# TODO: https://github.com/GoogleContainerTools/kaniko/issues/1331
# - name: Build image and push it to registries
# uses: int128/kaniko-action@v1
# with:
# push: true
# cache: true
# cache-repository: ${{ steps.ecr-cache.outputs.repository-uri }}
# tags: ${{ steps.metadata.outputs.tags }}
# labels: ${{ steps.metadata.outputs.labels }}
# build-args: |
# flutter_version=${{ env.FLUTTER_VERSION }}
# android_build_tools_version=${{ env.ANDROID_BUILD_TOOLS_VERSION }}
# android_platform_versions=${{ env.ANDROID_PLATFORM_VERSIONS }}
# kaniko-args: |
# --skip-unused-stages=true
# --use-new-run=true
# --snapshotMode=redo
# target: android
# executor: gcr.io/kaniko-project/executor:latest
# TODO: https://github.com/snok/container-retention-policy
# TODO: Push a build image before the final image
# TODO: Run basic tests with build image
# TODO: Push final image only if tests pass https://redhat-cop.github.io/ci/publishing-images.html