Skip to content

build_flatpak

build_flatpak #125

Workflow file for this run

---
name: build_flatpak
on:
push:
branches:
- main
# tags:
# - 'v*' # Push a tag (this is not a release!)
release: # new version with tag
pull_request:
page_build:
workflow_dispatch:
jobs:
flatpak:
name: "Flatpak"
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:kde-5.15-21.08
options: --privileged
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Clone flatpak manifest from Flathub
uses: GuillaumeFalourd/clone-github-repo-action@v1
with:
owner: 'flathub'
repository: 'com.github.chipmuenk.pyfda'
- name: list
run: ls
- name: Replace git tag by the commit id on which it runs
if: github.ref_type != 'tag'
run: >
sed -i 's@\&git_tag .*@\&git_tag "${{ github.sha }}"@' com.github.chipmuenk.pyfda/com.github.chipmuenk.pyfda.yaml
- name: Use correct git tag
if: github.ref_type == 'tag'
run: >
sed -i 's@\&git_tag .*@\&git_tag "${{ github.ref_name }}"@' com.github.chipmuenk.pyfda/com.github.chipmuenk.pyfda.yaml
- name: Replace source url
run: >
sed -i "s@\&git_url .*pyfda.git@\&git_url $GITHUB_SERVER_URL/$GITHUB_REPOSITORY@" com.github.chipmuenk.pyfda/com.github.chipmuenk.pyfda.yaml
- name: Add dev build marker to cmake options
if: github.ref_type != 'tag'
run: >
sed -i 's@config-opts: \["\(.*\)"\]@config-opts: ["\1", "-DDEV_BUILD=${{ github.ref_name }}"]@' com.github.chipmuenk.pyfda/com.github.chipmuenk.pyfda.yaml
- name: Replace desktop file name suffix
if: github.ref_type != 'tag'
run: >
sed -i 's@desktop-file-name-suffix: ""@desktop-file-name-suffix: " (Development)"@' com.github.chipmuenk.pyfda/com.github.chipmuenk.pyfda.yaml
- name: Show Flatpak manifest
run: cat com.github.chipmuenk.pyfda/com.github.chipmuenk.pyfda.yaml
- name: Build package
uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4
with:
bundle: com.github.chipmuenk.pyfda.flatpak
manifest-path: com.github.chipmuenk.pyfda/com.github.chipmuenk.pyfda.yaml
cache: false
branch: development
- name: Publish build artifacts
uses: actions/upload-artifact@v3
with:
path: com.github.chipmuenk.pyfda/*
name: pyfda Flatpak
Validate_appdata_file:
name: Validate appdata file
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: validation
# Command copied from flathub build process
run: |
sudo apt-get update
sudo apt install flatpak
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak install -y org.freedesktop.appstream-glib
flatpak run --env=G_DEBUG=fatal-criticals org.freedesktop.appstream-glib validate ./ressource/linux/pyfda.appdata.xml
prerelease:
# https://github.com/marvinpinto/actions/issues/177
needs: [flatpak]
runs-on: ubuntu-latest # does not matter which
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: list artifacts folder
run: |
echo "Show artifacts folder:"
ls artifacts
echo "Show artifacts/pyfda Flatpak folder:"
ls "artifacts/pyfda Flatpak"
echo "Show artifacts/com.github.chipmuenk.pyfda-x86_64:"
ls "artifacts/com.github.chipmuenk.pyfda-x86_64"
# - name: Update GitHub prerelease
# if: ${{ github.ref == 'refs/heads/main' }}
# uses: marvinpinto/action-automatic-releases@latest
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# automatic_release_tag: latest
# prerelease: true
# title: "Latest Build"
# files: |
# **/artifacts/pyfda Flatpak/com.github.chipmuenk.pyfda.yaml
# **/com.github.chipmuenk.pyfda-x86_64/*.flatpak
- name: Update GitHub prerelease
if: success() && github.ref_type != 'tag'
uses: pyTooling/Actions/releaser@main
with:
tag: latest
rm: false
token: ${{ secrets.GITHUB_TOKEN }}
files: |
**/artifacts/pyfda Flatpak/com.github.chipmuenk.pyfda.yaml
**/com.github.chipmuenk.pyfda-x86_64/*.flatpak
- name: Update versioned Github release
if: success() && github.ref_type == 'tag'
uses: pyTooling/Actions/releaser@main
with:
tag: ${{ github.ref_name }}
rm: false
token: ${{ secrets.GITHUB_TOKEN }}
files: |
**/artifacts/pyfda Flatpak/com.github.chipmuenk.pyfda.yaml
**/com.github.chipmuenk.pyfda-x86_64/*.flatpak
...