added workflow
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
name: Build Flutter Docker Image
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 3 * * *' # Every day at 03:00 UTC
|
||||
workflow_dispatch:
|
||||
|
||||
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: 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 \
|
||||
.
|
||||
Reference in New Issue
Block a user