Files
flutter-docker-image/.github/workflows/windows.yml
T
2025-03-16 22:57:08 +01:00

100 lines
3.8 KiB
YAML

on:
pull_request:
workflow_dispatch:
# Read-only permissions by default
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
test_image:
permissions:
# Allow to write packages for the docker/scout-action to write a comment
packages: write
# Allow to write pull requests for the docker/scout-action to write a comment
pull-requests: write
# Allow to write security events for github/codeql-action/upload-sarif to upload SARIF results
security-events: write
runs-on: windows-2025
env:
IMAGE_REPOSITORY_NAME: flutter-android
VERSION_MANIFEST: config/version.json
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Read environment variables from version.json
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
env:
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
IMAGE_REPOSITORY_NAME: ${{ env.IMAGE_REPOSITORY_NAME }}
VERSION_MANIFEST: ${{ env.VERSION_MANIFEST }}
with:
script: |
const script = require('./script/setEnvironmentVariables.js')
return await script({ core })
# - name: Load image metadata
# uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
# id: metadata
# with:
# images: |
# ${{ env.IMAGE_REPOSITORY_PATH }}
# tags: |
# type=raw,value=${{ env.FLUTTER_VERSION }}
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
- name: Build image and push to local Docker daemon
shell: powershell
run: |
docker build . -f windows.Dockerfile --build-arg flutter_version=${{ env.FLUTTER_VERSION }} -t ${{ env.IMAGE_REPOSITORY_PATH }}
# - name: Build image and push to local Docker daemon
# uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
# with:
# file: windows.Dockerfile
# load: true
# cache-from: type=gha
# cache-to: type=gha,mode=max
# labels: ${{ steps.metadata.outputs.labels }}
# tags: ${{ steps.metadata.outputs.tags }}
# target: android
# build-args: |
# flutter_version=${{ env.FLUTTER_VERSION }}
# - name: Test image
# uses: plexsystems/container-structure-test-action@c0a028aa96e8e82ae35be556040340cbb3e280ca # v0.3.0
# with:
# image: ${{ fromJSON(steps.metadata.outputs.json).tags[0] }}
# config: test/android.yml
# # TODO: Parallelize testing and vulnerability scanning
# - name: Scan with Docker Scout
# id: docker-scout
# uses: docker/scout-action@0133ff88fe16d4a412dc4827a8fccbccb6b583e0 # v1.16.3
# with:
# command: compare, recommendations
# # Use the Docker Hub image that is the first tag in the metadata
# image: local://${{ fromJson(steps.metadata.outputs.json).tags[0] }}
# # github-token is needed to be able to write the PR comment
# github-token: ${{ github.token }}
# only-fixed: true
# organization: ${{ secrets.DOCKER_HUB_USERNAME }}
# # sarif-file: output.sarif.json
# to-env: prod
# # Enable debug logging when needed
# # debug: true
# # verbose-debug: true