All checks were successful
Build Flutter Docker Image / build (release) Successful in 9s
67 lines
2.1 KiB
YAML
67 lines
2.1 KiB
YAML
name: Build Flutter Docker Image
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 3 * * *' # Every day at 03:00 UTC
|
|
workflow_dispatch:
|
|
release: # Trigger on release creation
|
|
types: [ published ]
|
|
|
|
env:
|
|
IMAGE_NAME: singatias/flutter
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y jq curl
|
|
|
|
- name: Get latest Flutter version
|
|
id: flutter_version
|
|
run: |
|
|
FLUTTER_VERSION=$(curl -s https://storage.googleapis.com/flutter_infra_release/releases/releases_linux.json | \
|
|
jq -r '. as $root | $root.current_release.stable as $stable_hash | $root.releases[] | select(.hash == $stable_hash) | .version')
|
|
echo "FLUTTER_VERSION=$FLUTTER_VERSION" >> $GITHUB_ENV
|
|
echo "Latest Flutter version: $FLUTTER_VERSION"
|
|
|
|
- name: Check if Docker image exists
|
|
id: check_image
|
|
run: |
|
|
IMAGE_TAG="${IMAGE_NAME}:${FLUTTER_VERSION}"
|
|
if docker manifest inspect $IMAGE_TAG > /dev/null 2>&1; then
|
|
echo "Image already exists for $FLUTTER_VERSION"
|
|
echo "exists=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "Image does not exist for $FLUTTER_VERSION"
|
|
echo "exists=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Debug output
|
|
run: |
|
|
echo "Exists: ${{ steps.check_image.outputs.exists }}"
|
|
|
|
- name: Log in to DockerHub
|
|
if: steps.check_image.outputs.exists == 'false'
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
|
|
|
|
- name: Build, push, and generate SBOM and provenance
|
|
if: steps.check_image.outputs.exists == 'false'
|
|
run: |
|
|
docker buildx build \
|
|
--provenance=true \
|
|
--sbom=true \
|
|
--push \
|
|
-t ${{ IMAGE_NAME }}:${{ FLUTTER_VERSION }} \
|
|
-t ${{ IMAGE_NAME }}:latest \
|
|
.
|