Skip to content

Commit 1db3733

Browse files
committed
ci: Build test
1 parent 21aadda commit 1db3733

File tree

1 file changed

+18
-50
lines changed

1 file changed

+18
-50
lines changed

.github/workflows/packages.yml

Lines changed: 18 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -862,12 +862,6 @@ jobs:
862862
echo "Using version: $(cat $GITHUB_OUTPUT | grep VERSION | cut -d= -f2)"
863863
echo "VERSION=$(cat $GITHUB_OUTPUT | grep VERSION | cut -d= -f2)" >> $GITHUB_ENV
864864
865-
- name: Install Snapcraft
866-
run: |
867-
sudo snap install snapcraft --classic
868-
sudo apt-get update
869-
sudo apt-get install -y curl jq
870-
871865
- name: Download Linux binary
872866
uses: robinraju/[email protected]
873867
with:
@@ -879,52 +873,28 @@ jobs:
879873

880874
- name: Create Snap directory structure
881875
run: |
882-
mkdir -p apisnip/snap/local/
883-
mkdir -p apisnip/meta/gui
876+
mkdir -p snap-build/bin
877+
mkdir -p snap-build/snap
884878
885879
# Extract binary
886-
mkdir -p apisnip/bin
887-
tar -xzf ./downloaded/apisnip-linux-x86_64.tar.gz -C apisnip
880+
tar -xzf ./downloaded/apisnip-linux-x86_64.tar.gz -C snap-build
888881
889882
# Move binary to the right place
890-
if [ -f "apisnip/apisnip" ]; then
891-
mv apisnip/apisnip apisnip/bin/
892-
elif [ -f "apisnip/usr/bin/apisnip" ]; then
893-
mkdir -p apisnip/bin
894-
mv apisnip/usr/bin/apisnip apisnip/bin/
883+
if [ -f "snap-build/apisnip" ]; then
884+
mv snap-build/apisnip snap-build/bin/
885+
elif [ -f "snap-build/usr/bin/apisnip" ]; then
886+
mkdir -p snap-build/bin
887+
mv snap-build/usr/bin/apisnip snap-build/bin/
895888
fi
896889
897890
# Ensure binary is executable
898-
chmod +x apisnip/bin/apisnip
899-
900-
# Create snap.yaml
901-
cat > apisnip/meta/snap.yaml << EOF
902-
name: apisnip
903-
version: ${{ env.VERSION }}
904-
summary: A terminal user interface (TUI) tool for trimming OpenAPI specifications
905-
description: |
906-
ApiSnip is a command-line tool that helps you trim down large OpenAPI specifications
907-
to only the parts you need. It provides a user-friendly terminal interface for
908-
selecting specific endpoints and data models.
909-
910-
grade: stable
911-
confinement: strict
912-
base: core20
913-
914-
apps:
915-
apisnip:
916-
command: bin/apisnip
917-
plugs:
918-
- home
919-
- network
920-
- network-bind
921-
EOF
891+
chmod +x snap-build/bin/apisnip
922892
923-
# Create snapcraft.yaml
924-
cat > apisnip/snap/snapcraft.yaml << EOF
893+
# Create snapcraft.yaml in snap/ directory
894+
cat > snap-build/snap/snapcraft.yaml << EOF
925895
name: apisnip
926896
version: ${{ env.VERSION }}
927-
summary: A terminal user interface (TUI) tool for trimming OpenAPI specifications
897+
summary: A terminal user interface tool for trimming OpenAPI specifications
928898
description: |
929899
ApiSnip is a command-line tool that helps you trim down large OpenAPI specifications
930900
to only the parts you need. It provides a user-friendly terminal interface for
@@ -951,25 +921,23 @@ jobs:
951921
- network-bind
952922
EOF
953923
954-
- name: Build Snap package
924+
- name: Build Snap package using Docker
955925
id: build_snap
956926
run: |
957-
cd apisnip
958-
snapcraft
927+
# Use Docker snapcraft image instead of multipass
928+
docker run --rm -v $(pwd)/snap-build:/build -w /build snapcore/snapcraft:stable snapcraft
959929
960930
# Find the snap file
961-
SNAP_FILE=$(find . -name "*.snap" | head -1)
931+
SNAP_FILE=$(find snap-build -name "*.snap" | head -1)
962932
if [ -z "$SNAP_FILE" ]; then
963933
echo "Error: No snap file found"
964934
exit 1
965935
fi
966936
967-
# Copy snap file to workspace root
968-
cp "$SNAP_FILE" ../
969-
cd ..
970-
971937
# Get the filename
972938
SNAP_FILENAME=$(basename "$SNAP_FILE")
939+
cp "$SNAP_FILE" ./
940+
973941
echo "SNAP_FILENAME=$SNAP_FILENAME" >> $GITHUB_OUTPUT
974942
975943
# Create checksum

0 commit comments

Comments
 (0)