Skip to content

Commit

Permalink
create action yaml and test
Browse files Browse the repository at this point in the history
  • Loading branch information
andy5995 committed Feb 2, 2024
1 parent 36370bc commit e9b924d
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Test Action

on:
push:
branches: trunk
pull_request:
branches: trunk

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
platform: ['linux/amd64']
env:
APPDIR: $GITHUB_WORKSPACE/AppDir
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use action from self
id: linuxdeploy
uses: ./
with:
platform: ${{ matrix.platform }}
build_commands: |
export -p
git clone --depth 1 https://github.com/theimpossibleastronaut/rmw
cd rmw
meson setup _build
cd _build
ninja
meson install --destdir=$APPDIR --skip-subprojects
ld_desktop_file: packaging/rmw.desktop
ld_icon_file: packaging/rmw_icon_32x32.png
ld_icon_filename: rmw
ld_executable_dir: ${{ env.APPDIR }}/usr/bin/rmw

- name: Upload AppImage
uses: actions/upload-artifact@v2
with:
name: appimage
path: ${{ steps.linuxdeploy.outputs.destination_dir }}/out/*.AppImage
75 changes: 75 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: 'LinuxDeploy Action'
inputs:
platform:
description: 'Target platform for LinuxDeploy'
required: true
default: 'linux/amd64'
install_commands:
description: 'Commands to install dependencies'
required: false
default: ''
build_commands:
description: 'Commands to build the project'
required: false
default: ''
ld_desktop_file:
description: ''
required: true
ld_icon_file:
description: ''
required: true
ld_icon_filename:
description: ''
required: true
ld_executable_dir:
description: 'Executable to deploy'
required: true
ld_appdir:
description: 'Path to target AppDir'
required: true

runs:
using: 'composite'
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Run LinuxDeploy
id: linuxdeploy
shell: bash
run: |
export -p
case ${{ inputs.platform }} in
'linux/amd64')
docker_image='your-docker-image-amd64:latest'
;;
'linux/arm64')
docker_image='your-docker-image-arm64:latest'
;;
*)
echo "Unsupported platform: ${{ inputs.platform }}"
exit 1
;;
esac
# Run the selected Docker image
docker run \
-e $APPDIR --rm -v $(pwd):/workspace \
--platform ${{ inputs.platform }} \
andy5995/linuxdeploy:latest /bin/sh -c "
export -p
sudo chmod 777 /workspace
if [ -n '${{ inputs.install_commands }}' ]; then
eval '${{ inputs.install_commands }}'
fi
# Run user-provided build commands
if [ -n '${{ inputs.build_commands }}' ]; then
eval '${{ inputs.build_commands }}'
fi
linuxdeploy \
--appdir $APPDIR \
-d ${{ inputs.ld_desktop_file }} \
--icon-file=${{ inputs.ld_icon_file }} \
--icon-filename=${{ inputs.ld_icon_filename }} \
--executable ${{ inputs.ld_executable }} \
--output appimage
"

0 comments on commit e9b924d

Please sign in to comment.