Skip to content
This repository has been archived by the owner on Jan 12, 2025. It is now read-only.

Update build-and-release-snapshots.yml #8

Update build-and-release-snapshots.yml

Update build-and-release-snapshots.yml #8

name: Build and Release Flutter Application
on: [push, pull_request]
jobs:
build-and-release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
artifact-name: "Windows-Snapshot.zip"
build-command: "flutter build windows"
output-path: "./build/windows/runner/Release" # Adjust this path
- os: ubuntu-latest
artifact-name: "Linux-Snapshot.zip"
build-command: "flutter build linux"
output-path: "./build/linux/release/bundle" # Confirm and adjust this path
- os: macos-latest
artifact-name: "macOS-Snapshot.zip"
build-command: "flutter build macos"
output-path: "./build/macos/Build/Products/Release" # Adjust this path
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y cmake ninja-build libgtk-3-dev
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Build
run: ${{ matrix.build-command }}
- name: Debugging - List Build Directory Contents (Linux only)
if: matrix.os == 'ubuntu-latest'
run: |
echo "Listing contents of the expected output directory..."
ls -alh ${{ matrix.output-path }} || true
- name: Zip artifacts
run: |
if [ -d "${{ matrix.output-path }}" ]; then
zip -r ${{ matrix.artifact-name }} ${{ matrix.output-path }}
else
echo "Specified output path does not exist, skipping zip step."
exit 1
fi
- name: Upload Artifact to Release
if: success()
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact-name }}
path: ${{ matrix.artifact-name }}
release:
needs: build-and-release
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: snapshot-${{ github.run_number }}
release_name: Snapshot Release ${{ github.run_number }}
draft: false
prerelease: true
- name: Download Artifacts
uses: actions/download-artifact@v2
- name: Upload Artifacts to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ matrix.artifact-name }}
asset_name: ${{ matrix.artifact-name }}
asset_content_type: application/zip