image: cirrusci/flutter:3.10.0   # Use a Flutter Docker image

pipelines:
  branches:
    main:
      - step:
          name: Build Flutter Web App
          oidc: true  # Enable OIDC for AWS authentication
          deployment: staging # Set to get correct variables
          script:
            - flutter pub get
            - flutter analyze
            - flutter build web --release
            - echo "Deploying to S3..."
            - pipe: atlassian/aws-s3-deploy:1.1.0
              variables:
                AWS_OIDC_ROLE_ARN: $AWS_ARN
                AWS_DEFAULT_REGION: $AWS_REGION
                S3_BUCKET: $AWS_S3_BUCKET
                LOCAL_PATH: './build/web'