Skip to content

Update main.yml

Update main.yml #25

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- main
jobs:
build_and_deploy:
runs-on: ${{ matrix.image }}
permissions:
contents: write
strategy:
matrix:
image: ["windows-latest", "macos-latest", "ubuntu-latest"]
new_version: ["1.0.1"]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: pip install -r app/requirements.txt
- name: Build application
run: |
if [ "${{ matrix.image }}" == 'debian' ]; then
echo "Debian"
elif [ "${{ matrix.image }}" == 'windows-latest' ]; then
flet pack app/main.py --name watch-movies --icon app/assets/icon.png --product-name watch-movies --add-data "app/assets;assets" --copyright "Copyright (c) 2024 Edoardo Gruppi"
elif [ "${{ matrix.image }}" == 'macos-latest' ]; then
flet pack app/main.py --name watch-movies --icon app/assets/icon.png --product-name watch-movies --add-data "app/assets:assets" --copyright "Copyright (c) 2024 Edoardo Gruppi"
elif [ "${{ matrix.image }}" == 'ubuntu-latest' ]; then
flet pack app/main.py --name watch-movies --icon app/assets/icon.png --product-name watch-movies --add-data "app/assets:assets" --copyright "Copyright (c) 2024 Edoardo Gruppi"
fi
shell: bash
- name: Archive artifacts
run: |
if [ "${{ matrix.image }}" == 'debian' ]; then
ls $GITHUB_WORKSPACE
elif [ "${{ matrix.image }}" == 'windows-latest' ]; then
7z a watch-movies-windows.zip dist/*.exe
ls $GITHUB_WORKSPACE
elif [ "${{ matrix.image }}" == 'macos-latest' ]; then
tar -czvf watch-movies-macos.tar.gz -C dist watch-movies.app
ls $GITHUB_WORKSPACE
elif [ "${{ matrix.image }}" == 'ubuntu-latest' ]; then
tar -czvf watch-movies-linux.tar.gz -C dist watch-movies
ls $GITHUB_WORKSPACE
fi
shell: bash
- name: Publish artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.image }}-package
path: |
${{ github.workspace }}/*.zip
${{ github.workspace }}/*.tar.gz
- name: Create and publish release
id: create_release
uses: ncipollo/release-action@v1.14.0
with:
allowUpdates: true
replacesArtifacts: true
tag: v${{ matrix.new_version }}
name: Watch_Movies v${{ matrix.new_version }}
body: "New release"
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: |
${{ github.workspace }}/watch-movies-macos.tar.gz
${{ github.workspace }}/watch-movies-windows.zip
${{ github.workspace }}/watch-movies-linux.tar.gz