Skip to content

Build and Publish Flutter Docker Image #187

Build and Publish Flutter Docker Image

Build and Publish Flutter Docker Image #187

Workflow file for this run

name: Build and Publish Flutter Docker Image
on:
workflow_dispatch:
schedule:
- cron: "0 17 * * *" # JTS 02:00
env:
REGISTRY: ghcr.io
IMAGE_NAME: KoheiKanagu/flutter
permissions:
id-token: write
contents: read
packages: write
attestations: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-docker
cancel-in-progress: true
jobs:
check-flutter-version:
timeout-minutes: 30
runs-on: ubuntu-latest
outputs:
flutter_version: ${{ steps.check-flutter-version.outputs.flutter_version }}
steps:
- uses: actions/checkout@v4.2.1
- name: Get Flutter version
id: check-flutter-version
run: echo "flutter_version=$(yq eval '.environment.flutter' pubspec.yaml)" >>"$GITHUB_OUTPUT"
build_and_publish:
timeout-minutes: 30
runs-on: ubuntu-latest
needs: check-flutter-version
steps:
- uses: actions/checkout@v4.2.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.7.1
- name: Login to GitHub Container Registry
uses: docker/login-action@v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5.5.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ needs.check-flutter-version.outputs.flutter_version }}
- name: Build and push
id: push
uses: docker/build-push-action@v6.9.0
with:
context: .
push: true
build-args: |
FLUTTER_VERSION=${{ needs.check-flutter-version.outputs.flutter_version }}
BUILDKIT_INLINE_CACHE=1
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1.4.3
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}