Build and Publish Flutter Docker Image #197
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: 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/[email protected] | |
- 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/[email protected] | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Login to GitHub Container Registry | |
uses: docker/[email protected] | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/[email protected] | |
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/[email protected] | |
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/[email protected] | |
with: | |
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | |
subject-digest: ${{ steps.push.outputs.digest }} |