Skip to content

Commit 1515354

Browse files
committed
ci: fix zip command
1 parent fd58970 commit 1515354

File tree

2 files changed

+31
-23
lines changed

2 files changed

+31
-23
lines changed

.github/workflows/package-release.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,21 @@ jobs:
3838
- name: Create package
3939
id: create_package
4040
run: |
41-
OUTPUT=$(.github/workflows/scripts/create-package.sh "${{ steps.version.outputs.version }}" "${{ steps.current_time.outputs.timestamp }}")
42-
echo "PACKAGE_PATH=$OUTPUT" >> $GITHUB_ENV
43-
echo "package_path=$OUTPUT" >> $GITHUB_OUTPUT
41+
# Capture output in a variable
42+
RESULT=$(.github/workflows/scripts/create-package.sh "${{ steps.version.outputs.version }}" "${{ steps.current_time.outputs.timestamp }}")
43+
# Check if script succeeded
44+
if [ $? -ne 0 ]; then
45+
echo "Error creating package"
46+
exit 1
47+
fi
48+
# Check if file exists
49+
if [ ! -f "$RESULT" ]; then
50+
echo "Package file not found: $RESULT"
51+
exit 1
52+
fi
53+
# Set outputs
54+
echo "PACKAGE_PATH=$RESULT" >> $GITHUB_ENV
55+
echo "package_path=$RESULT" >> $GITHUB_OUTPUT
4456
4557
- name: Create Release
4658
id: create_release
@@ -62,4 +74,5 @@ jobs:
6274
- Build Date: ${{ steps.current_time.outputs.timestamp }}
6375
- Created by: ${{ github.actor }}
6476
env:
65-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+

.github/workflows/scripts/create-package.sh

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,8 @@ if [ -z "$VERSION" ]; then
1010
exit 1
1111
fi
1212

13-
# Format the package name similar to common software package conventions
14-
# You can choose one of these formats by uncommenting the preferred one:
15-
16-
# Option 1: Simple format with version only
13+
# Format the package name
1714
PACKAGE_NAME="rider-waite-smith-${VERSION}"
18-
19-
# Option 2: RPM-like format with version and build date
20-
# PACKAGE_NAME="rider-waite-smith-${VERSION}-${TIMESTAMP}"
21-
22-
# Option 3: Debian-like format
23-
# PACKAGE_NAME="rider-waite-smith_${VERSION}_all"
24-
25-
# Option a standard format
26-
# PACKAGE_NAME="rider-waite-smith-v${VERSION}"
27-
2815
ZIP_FILE="${PACKAGE_NAME}.zip"
2916

3017
# Create a temporary directory for packaging
@@ -36,7 +23,7 @@ mkdir -p "${DECK_DIR}"
3623
cp -r rider-waite-smith/* "${DECK_DIR}/"
3724

3825
# Include metadata file with package info
39-
cat > "${DECK_DIR}/PACKAGE-INFO.txt" << EOL
26+
cat >"${DECK_DIR}/PACKAGE-INFO.txt" <<EOL
4027
Package: Rider-Waite-Smith Tarot Deck
4128
Version: ${VERSION}
4229
Build Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
@@ -46,14 +33,22 @@ Repository: ${GITHUB_REPOSITORY:-"arcanaland/specifications"}
4633
This package follows the Tarot Deck Specification v1.0.
4734
EOL
4835

49-
# Create the zip file
50-
(cd "${TEMP_DIR}" && zip -r "${ZIP_FILE}" "${PACKAGE_NAME}")
36+
# Create the zip file and suppress the output
37+
(cd "${TEMP_DIR}" && zip -r "${ZIP_FILE}" "${PACKAGE_NAME}" >/dev/null)
38+
39+
# Check if zip command was successful
40+
if [ $? -ne 0 ]; then
41+
echo "ERROR: Failed to create zip file" >&2
42+
rm -rf "${TEMP_DIR}"
43+
exit 1
44+
fi
5145

5246
# Move the zip file to the current directory
5347
mv "${TEMP_DIR}/${ZIP_FILE}" .
5448

5549
# Clean up the temporary directory
5650
rm -rf "${TEMP_DIR}"
5751

58-
# Output the path to the zip file
59-
echo "${ZIP_FILE}"
52+
# Output just the filename, no other text
53+
echo "${ZIP_FILE}"
54+

0 commit comments

Comments
 (0)