Update build-and-release-snapshots.yml #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
build-command: "flutter build windows" | |
- os: ubuntu-latest | |
artifact-name: "Linux-Snapshot" | |
build-command: "flutter build linux" | |
- os: macos-latest | |
artifact-name: "macOS-Snapshot" | |
build-command: "flutter build macos" | |
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: Verify CMake, Ninja, and GTK+ 3 Installation (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
cmake --version | |
ninja --version | |
pkg-config --modversion gtk+-3.0 | |
- name: Build | |
run: ${{ matrix.build-command }} | |
- name: Zip artifacts | |
run: | | |
zip -r ${{ matrix.artifact-name }}.zip ./path/to/build/output | |
- 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: Upload Artifact 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 }}.zip | |
asset_name: ${{ matrix.artifact-name }}.zip | |
asset_content_type: application/zip |