docker-flutter-sdk/.gitea/workflows/publish.yaml
Mathias Beaulieu-Duncan 9c4100dce5
Some checks failed
Build and Push Flutter SDK Image / build-and-push (Flutter SDK for Android CI builds, Dockerfile.android, gpb-flutter-sdk-android) (release) Failing after 7s
Build and Push Flutter SDK Image / build-and-push (Minimal Flutter SDK for Web/WASM CI builds, Dockerfile, gpb-flutter-sdk-web) (release) Failing after 7s
Build and Push Flutter SDK Image / build-and-push (Flutter SDK for Linux desktop CI builds, Dockerfile.linux, gpb-flutter-sdk-linux) (release) Failing after 8s
Use latest Flutter stable for pre-release builds
Pre-release triggers now fetch the current Flutter stable version
from the releases API instead of using the release tag. This allows
testing the pipeline with any pre-release tag name.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 00:59:50 -05:00

94 lines
3.6 KiB
YAML

name: Build and Push Flutter SDK Image
on:
release:
types: [published, prereleased]
permissions:
contents: read
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- dockerfile: Dockerfile
image_name: gpb-flutter-sdk-web
description: Minimal Flutter SDK for Web/WASM CI builds
- dockerfile: Dockerfile.android
image_name: gpb-flutter-sdk-android
description: Flutter SDK for Android CI builds
- dockerfile: Dockerfile.linux
image_name: gpb-flutter-sdk-linux
description: Flutter SDK for Linux desktop CI builds
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Determine version and tag type
id: version
run: |
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
# Pre-release: fetch latest stable version, tag as dev
FLUTTER_VERSION=$(curl -fsSL https://storage.googleapis.com/flutter_infra_release/releases/releases_linux.json \
| jq -r '.current_release.stable as $hash | .releases[] | select(.hash == $hash and .channel == "stable") | .version')
echo "flutter_version=${FLUTTER_VERSION}" >> $GITHUB_OUTPUT
echo "tag=dev" >> $GITHUB_OUTPUT
echo "Using latest Flutter stable ${FLUTTER_VERSION} for pre-release test"
else
# Full release: use the release tag as the Flutter version
echo "flutter_version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
echo "tag=latest" >> $GITHUB_OUTPUT
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build image for Scout analysis
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/amd64
push: false
load: true
build-args: |
FLUTTER_VERSION=${{ steps.version.outputs.flutter_version }}
tags: ${{ vars.REGISTRY }}/${{ matrix.image_name }}:${{ steps.version.outputs.flutter_version }}
- name: Install Docker Scout
run: |
curl -fsSL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh -o install-scout.sh
sh install-scout.sh
- name: Docker Scout CVE Scan
run: |
docker scout cves ${{ vars.REGISTRY }}/${{ matrix.image_name }}:${{ steps.version.outputs.flutter_version }} --only-severity critical,high
- name: Build and push with attestations
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/amd64
push: true
sbom: true
provenance: mode=max
build-args: |
FLUTTER_VERSION=${{ steps.version.outputs.flutter_version }}
tags: |
${{ vars.REGISTRY }}/${{ matrix.image_name }}:${{ steps.version.outputs.flutter_version }}
${{ vars.REGISTRY }}/${{ matrix.image_name }}:${{ steps.version.outputs.tag }}
labels: |
org.opencontainers.image.title=${{ matrix.image_name }}
org.opencontainers.image.description=${{ matrix.description }}
org.opencontainers.image.version=${{ steps.version.outputs.flutter_version }}
org.opencontainers.image.revision=${{ github.sha }}