From 0903c35bfdb422697cc0097bff069edb4117c131 Mon Sep 17 00:00:00 2001 From: florianvazelle Date: Sat, 2 Dec 2023 19:43:49 +0100 Subject: [PATCH] ci: enable snapcraft packaging (#22) * ci: refactor snapcraft * fix: update the icon * chore: add changelog entry * fix style --- .github/workflows/snapcraft-build.yaml | 53 +++++++----- CHANGELOG.md | 1 + Justfile | 6 ++ assets/icon.png | Bin 2905 -> 4427 bytes assets/icon.svg | 76 ++++++++++++++++++ public/.gitignore | 1 + .../org.mechanicalflower.Marble.desktop | 2 +- public/packaging/snap/snapcraft.yaml | 60 +++++++------- 8 files changed, 147 insertions(+), 52 deletions(-) create mode 100644 assets/icon.svg diff --git a/.github/workflows/snapcraft-build.yaml b/.github/workflows/snapcraft-build.yaml index 0f1737c..ad54067 100644 --- a/.github/workflows/snapcraft-build.yaml +++ b/.github/workflows/snapcraft-build.yaml @@ -1,29 +1,46 @@ - -name: "Snapcraft build" +name: Snapcraft Build on: + push: workflow_dispatch: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 + timeout-minutes: 30 + steps: - - name: Checkout repository - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + - uses: extractions/setup-just@v1 + + - name: Load dotenv + run: just bump-version - - name: Build snap package - uses: snapcore/action-build@v1 - id: snapcraft + - name: Build snap package + uses: snapcore/action-build@v1 + working-directory: public/packaging + id: snapcraft - - name: Install built snap package - run: | - sudo snap install --dangerous ${{ steps.snapcraft.outputs.snap }} + # Push, on each commit of the main branch, to the edge channel + - uses: snapcore/action-publish@v1 + if: github.ref == 'refs/heads/main' + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }} + with: + snap: ${{ steps.snapcraft.outputs.snap }} + release: edge - - name: Install dependencies for test launch - run: | - sudo apt install -y mesa-utils libgl1-mesa-dri libglx-mesa0 + - name: Update the snapcraft to be stable + if: startsWith(github.ref, 'refs/tags/') + run: | + sed -i "s,grade:\ devel$,grade:\ stable\",g" ./public/packaging/snap/snapcraft.yaml + sed -i "s,confinement:\ devmode$,confinement:\ strict,g" ./public/packaging/snap/snapcraft.yaml - - name: Test marble launch - uses: GabrielBB/xvfb-action@v1.6 - with: - run: /bin/bash public/packaging/snap/snap-xvfb-launch.sh + # Push, on each tag, to the stable channel + - uses: snapcore/action-publish@v1 + if: startsWith(github.ref, 'refs/tags/') + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }} + with: + snap: ${{ steps.snapcraft.outputs.snap }} + release: stable diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ec4837..4666215 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [Unreleased] ### Added - Add web deploy ([#20](https://github.com/MechanicalFlower/Marble/pull/20)) +- Add snapcraft packaging ([#22](https://github.com/MechanicalFlower/Marble/pull/22)) ### Changed - Use Justfile as command runner ([#18](https://github.com/MechanicalFlower/Marble/pull/18)) ### Deprecated diff --git a/Justfile b/Justfile index 8f06522..7601dbe 100644 --- a/Justfile +++ b/Justfile @@ -111,6 +111,12 @@ import-resources: sed -i "s,application/version=.*$,application/version=\"{{ game_version }}\",g" ./export_presets.cfg sed -i "s,application/short_version=.*$,application/short_version=\"{{ short_version }}\",g" ./export_presets.cfg + echo "Update version in public/packaging" + sed -i "s,version:\ '.*'$,version:\ '{{ game_version }}',g" ./public/packaging/snap/snapcraft.yaml + sed -i "s,archive/refs/tags/.*\.tar\.gz$,archive/refs/tags/{{ game_version }}\.tar\.gz,g" ./public/packaging/snap/snapcraft.yaml + sed -i "s,releases/download/.*/Marble-linux-v.*\.zip$,releases/download/{{ game_version }}/Marble-linux-v{{ game_version }}\.zip,g" ./public/packaging/snap/snapcraft.yaml + sed -i "s,Version=.*$,Version={{ game_version }},g" ./public/packaging/org.mechanicalflower.Marble.desktop + echo "Create the override.cfg" touch override.cfg echo '[build_info]\npackage/version="{{ game_version }}"\npackage/build_date="{{ build_date }}"\nsource/commit="{{ commit_hash }}"' > override.cfg diff --git a/assets/icon.png b/assets/icon.png index 7b2f7791d90ccc999ebfe3aa119b4037b4c9e447..29235cdb3835882b4186b4c32f28cad760d0638d 100644 GIT binary patch literal 4427 zcmV-R5wz}!P))1_}~R2B}Aaa@<22o!Eg~VXppu9 zt)?wdYJDI@QR0Iy3K5M;eGo$siY?_*5vqWKw1X`SEuHJR?aP1vZ|mm6+UGiFpP9Dj zv?k@3OeWd?b@~0i>vv!42=6`5Ws=V}1J5@72!LmsfoGeZ^8iH86k z7Xl$AQbovCI{DpW78fYaoWz=D19yVB-8D&X_U@PUdT-|T+ud&Sx~l;E`yF@vth3eK zt||`;=kQV>vKBH;@y_9mfvN;!q17hpbzy>!$#d!_9-}EnxUxj187Q^3c9gVydhwxu zdRaSt1GnF9c8lj-0pOuuy(3vUYVMOs_7ah$5eW3s0^~WO+auaP4?3RH5iSU znMJiT08GD+Us)z!S->uy!UG~}Ba;-86zUrAqz5l^$=vKM*M9JWcRg*!*#!W;eET21 zMvMlZBu=8}zya{!y~nI9Lq0;JDeAyMgi@HI0Ovt#L>%FjLS-pJN?ciCmlmjpeVV}% zcDS<6q!0m+I6=)K(W^PGd^5P>ezx|#0)8YSVg~11Ieea)$V*DvDRYcatTZ^qK zY+0hx7Gide=#oqD-k}%H;#Zbou#6uM@kXQ41VJzXnWczU2Z2CjZHQw4oHaOOzI&~1^)R`J)eg=nFUe&YwLa06cKZ zZGUZt!|QMsU)6|C@Z`3vu~mh$!9jcHg2Rg<#J&R{!&V}WgQ`bSP-(dyC4E)noh8XK zI@Su-ydB;U41|}HwjTKNLv%(L1hU-DFg!F zXk-%MY8@nPY8Y>E*0cK%afDEE?Ih*Q48GIFHx;@n!qO^2s*tgJ=c&gdymh#08~~E* zxq@qI`cFLe-8}(7pLzU$M4Cx&4ArPly?7S8a2kp+R3+Y6Tode6CJA_tcNT^N{Ad7T zn?;qxX@j4rfQTZa0&xFL zH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GBRDw5-Dj7rSa#KgUxBhubjOW-R&v|p#3ce zct@`n&R#F-O$;oqvxeJn8CjsxLAsxsqc>Z|$89TM<~v0B&;Q7MQ3;`F zT=Z`%Kk0ig`fg#|C^DYUVCWtuNF!S8fD5SLRWZAG>QBga?sSVv>sw5uj<{1kq$MRi zOHq^kWY1vLdk*3Kwjav&G=G3MXV{9r%=i0muQ0^#!tZbz^^mXN4u3vfq(Fq>%(zOe zBP8>Qzp%#ZDCu^OaC1S{p}%^-_VL)vb==+MfIUZB?iIS;L0k|pAxU9rrF1C^i|&}J z-V2otn&nraJ&P?4QegQVsabe(eO1ze8GH}6VYhrAy~UW?c+mS#MhH5t2g}le<+~U# z5=bTIEa%uTNxz=HcZmA)V?H(1MV~&AsK3=s0neToW6}3!3(^V>oxA;)D)^MG=3jPV zYvzl5Atoris>d#8s z&ERcRDp=1x80#L4Q^N$}Km#BZkVsiYq%0C;t%y{+tf+=mkWo-jQ&6y85EJ|#fqwwj d+cW(C1&T`l738kOO@ji!NY7Na;+k9Re*llBb4~yN diff --git a/assets/icon.svg b/assets/icon.svg new file mode 100644 index 0000000..240c994 --- /dev/null +++ b/assets/icon.svg @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + diff --git a/public/.gitignore b/public/.gitignore index e4fdbdb..b2bab8b 100644 --- a/public/.gitignore +++ b/public/.gitignore @@ -1 +1,2 @@ *.import +*.snap diff --git a/public/packaging/org.mechanicalflower.Marble.desktop b/public/packaging/org.mechanicalflower.Marble.desktop index 6dab2d4..48c618d 100644 --- a/public/packaging/org.mechanicalflower.Marble.desktop +++ b/public/packaging/org.mechanicalflower.Marble.desktop @@ -1,6 +1,6 @@ [Desktop Entry] -Version=1.3 +Version=1.4.2 Type=Application Name=Marble diff --git a/public/packaging/snap/snapcraft.yaml b/public/packaging/snap/snapcraft.yaml index 00609e0..dc23fa2 100644 --- a/public/packaging/snap/snapcraft.yaml +++ b/public/packaging/snap/snapcraft.yaml @@ -2,56 +2,50 @@ --- name: marble base: core20 -version: '1.3' +version: '1.4.2' summary: A marble race minigame description: | A marble race minigame, made with Godot Engine. grade: devel confinement: devmode +license: MIT +architectures: [amd64] apps: marble: - command: usr/share/marble/Marble.x86_64 --main-pack $SNAP/usr/share/marble/Marble.pck -S $SNAP_USER_COMMON/save + command: Marble.x86_64 --main-pack $SNAP/Marble.pck --rendering-driver opengl3 + extensions: [gnome-3-38] plugs: - - home - pulseaudio - opengl - - screen-inhibit-control - - browser-support - x11 - # desktop: /usr/share/applications/org.mechanicalflower.Marble.desktop + desktop: org.mechanicalflower.Marble.desktop environment: - LIBGL_DRIVERS_PATH: $SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/dri + LD_LIBRARY_PATH: "$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio:$SNAP" parts: - marble: - source: . + marble-source: + source: https://github.com/MechanicalFlower/Marble/archive/refs/tags/1.4.2.tar.gz override-build: | - # Icon paths in the desktop file will be rewritten to use ${SNAP}/ if specified as desktop file in snapcraft.yaml - sed -i.bak -e "s|Icon=org.mechanicalflower.Marble$|Icon=meta/gui/icon.png|g" ${SNAPCRAFT_PART_SRC}/.github/org.mechanicalflower.Marble.desktop snapcraftctl build - mkdir -p ${SNAPCRAFT_PART_INSTALL}/usr/share/marble/ - cp ${SNAPCRAFT_PART_SRC}/Marble.x86_64 ${SNAPCRAFT_PART_INSTALL}/usr/share/marble/Marble.x86_64 - cp ${SNAPCRAFT_PART_SRC}/Marble.pck ${SNAPCRAFT_PART_INSTALL}/usr/share/marble/Marble.pck + + # Icon paths in the desktop file will be rewritten to use ${SNAP}/ if specified as desktop file in snapcraft.yaml + sed -i.bak -e "s|Icon=org.mechanicalflower.Marble$|Icon=gui/icon.png|g" ${SNAPCRAFT_PART_SRC}/public/packaging/org.mechanicalflower.Marble.desktop + + cp ${SNAPCRAFT_PART_SRC}/public/packaging/org.mechanicalflower.Marble.desktop ${SNAPCRAFT_PART_INSTALL}/org.mechanicalflower.Marble.desktop plugin: nil override-prime: | snapcraftctl prime - mkdir -p ${SNAPCRAFT_PRIME}/meta/gui - # cp ${SNAPCRAFT_PART_SRC}/org.mechanicalflower.Marble-256.png ${SNAPCRAFT_PRIME}/meta/gui/icon.png - stage-packages: - - libgl1 - - libglvnd0 - - libglx0 - - libx11-6 - - libxau6 - - libxcb1 - - libxcursor1 - - libxdmcp6 - - libxext6 - - libxfixes3 - - libxi6 - - libxinerama1 - - libxrandr2 - - libxrender1 - - libasound2 - - libpulse0 + + mkdir -p ${SNAPCRAFT_PRIME}/gui + cp ${SNAPCRAFT_PART_SRC}/assets/icon.png ${SNAPCRAFT_PRIME}/gui/icon.png + marble-dist: + source: https://github.com/MechanicalFlower/Marble/releases/download/1.4.2/Marble-linux-v1.4.2.zip + override-build: | + snapcraftctl build + + cp ${SNAPCRAFT_PART_SRC}/Marble.x86_64 ${SNAPCRAFT_PART_INSTALL}/Marble.x86_64 + cp ${SNAPCRAFT_PART_SRC}/Marble.pck ${SNAPCRAFT_PART_INSTALL}/Marble.pck + + chmod +x ${SNAPCRAFT_PART_INSTALL}/Marble.x86_64 + plugin: nil