RUN BUILD #33
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
on: | |
repository_dispatch: | |
workflow_dispatch: | |
inputs: | |
arg_type: | |
description: '类型: --runtime/--app' | |
required: true | |
default: '--runtime' | |
arg_packname: | |
description: '包名比如: org.freedesktop.Sdk' | |
required: true | |
default: '' | |
arg_branch: | |
description: '分支: stable/22.08' | |
required: true | |
default: '22.08' | |
arg_repopath: | |
description: '实际安装路径, 默认即可' | |
required: true | |
default: '/var/lib/flatpak/repo' | |
arg_export_all: | |
description: '是否导出所有相关依赖包' | |
required: true | |
default: 'false' | |
name: RUN BUILD | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Initialization environment | |
run: | | |
echo $(nproc) | |
free -h | |
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc | |
sudo -E apt-get -qq update | |
sudo -E apt-get -qq install flatpak | |
- name: install app | |
run: | | |
sudo -E apt-get -qq install flatpak | |
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo | |
sudo flatpak install ${{ github.event.inputs.arg_type }} flathub ${{ github.event.inputs.arg_packname }}//${{ github.event.inputs.arg_branch }} -y | |
- name: export .flatpak file | |
if: github.event.inputs.arg_type == '--runtime' && github.event.inputs.arg_export_all == 'false' | |
run: | | |
sudo flatpak build-bundle ${{ github.event.inputs.arg_type }} ${{ github.event.inputs.arg_repopath }} ${{ github.event.inputs.arg_packname }}_${{ github.event.inputs.arg_branch }}.flatpak ${{ github.event.inputs.arg_packname }} ${{ github.event.inputs.arg_branch }} | |
- name: export .flatpak file | |
if: github.event.inputs.arg_type == '--app' && github.event.inputs.arg_export_all == 'false' | |
run: | | |
sudo flatpak build-bundle ${{ github.event.inputs.arg_repopath }} ${{ github.event.inputs.arg_packname }}_${{ github.event.inputs.arg_branch }}.flatpak ${{ github.event.inputs.arg_packname }} ${{ github.event.inputs.arg_branch }} | |
# 全部导出 | |
- name: export .flatpak all | |
if: github.event.inputs.arg_export_all != 'false' | |
run: | | |
# 导出app | |
sudo flatpak list --app --columns=application,branch|awk '{printf "sudo flatpak build-bundle ${{ github.event.inputs.arg_repopath }} "$1"_"$2".flatpak "$1" "$2"\n"}'|xargs -I {} bash -c {} | |
# 导出runtime | |
sudo flatpak list --runtime --columns=application,branch|awk '{printf "sudo flatpak build-bundle ${{ github.event.inputs.arg_repopath }} --runtime "$1"_"$2".flatpak "$1" "$2"\n"}'|xargs -I {} bash -c {} | |
- name: Release set path | |
run: | | |
md5sum ./*.flatpak>release.txt | |
echo "RELEASE_PATH=$PWD" >> $GITHUB_ENV | |
echo "FILE_DATE=_$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.arg_packname }}_${{ github.event.inputs.arg_branch }}${{ env.FILE_DATE }} | |
body_path: release.txt | |
files: ${{ env.RELEASE_PATH }}/*.flatpak |