Skip to content

Commit 6994f96

Browse files
committed
Use the github release archive for package data
1 parent 0a2708e commit 6994f96

2 files changed

Lines changed: 12 additions & 32 deletions

File tree

.github/scripts/update_package_index.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ def main():
1313
checksum = os.environ.get('CHECKSUM')
1414
size = os.environ.get('SIZE')
1515

16-
if not all([version, archive_name, checksum, size]):
16+
if not all([version, checksum, size]):
1717
print("Error: Missing required environment variables")
18-
print(f"VERSION={version}, ARCHIVE_NAME={archive_name}, CHECKSUM={checksum}, SIZE={size}")
18+
print(f"VERSION={version}, CHECKSUM={checksum}, SIZE={size}")
1919
sys.exit(1)
2020

2121
# Load existing package index
@@ -31,8 +31,8 @@ def main():
3131
"help": {
3232
"online": "https://github.com/h2zero/n-able-Arduino/issues"
3333
},
34-
"url": f"https://github.com/h2zero/n-able-Arduino/archive/{version}.tar.gz",
35-
"archiveFileName": archive_name,
34+
"url": f"https://github.com/h2zero/n-able-Arduino/archive/refs/tags/{version}.tar.gz",
35+
"archiveFileName": f"n-able-Arduino-{version}.tar.gz",
3636
"checksum": f"SHA-256:{checksum}",
3737
"size": str(size),
3838
"boards": [

.github/workflows/release.yml

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,46 +32,26 @@ jobs:
3232
VERSION=${VERSION#v}
3333
echo "version=${VERSION}" >> $GITHUB_OUTPUT
3434
35-
- name: Create source archive
35+
- name: Download release archive
3636
id: archive
3737
run: |
3838
VERSION=${{ steps.version.outputs.version }}
3939
ARCHIVE_NAME="n-able-Arduino-${VERSION}.tar.gz"
40-
echo "Creating archive: ${ARCHIVE_NAME}"
40+
ARCHIVE_URL="https://github.com/${{ github.repository }}/archive/refs/tags/${VERSION}.tar.gz"
4141
42-
# Temporarily disable exit on error for tar (it may return 1 if files change during archiving)
43-
set +e
44-
tar --warning=no-file-changed -czf "${ARCHIVE_NAME}" \
45-
--exclude=.git \
46-
--exclude=.github \
47-
--exclude=.gitignore \
48-
--exclude=.gitattributes \
49-
--exclude=node_modules \
50-
--exclude=build \
51-
--exclude=dist \
52-
--exclude='*.tar.gz' \
53-
--transform="s,^,n-able-Arduino-${VERSION}/," \
54-
.
55-
TAR_EXIT=$?
56-
set -e
42+
echo "Downloading archive from: ${ARCHIVE_URL}"
43+
curl -sL -o "${ARCHIVE_NAME}" "${ARCHIVE_URL}"
5744
58-
# Tar exit codes: 0 = success, 1 = some files changed during archiving (but archive created)
59-
if [ $TAR_EXIT -gt 1 ]; then
60-
echo "Tar failed with exit code $TAR_EXIT"
61-
ls -la
45+
if [ ! -f "${ARCHIVE_NAME}" ]; then
46+
echo "Failed to download archive!"
6247
exit 1
6348
fi
6449
6550
# Calculate checksum and size
66-
echo "Files in directory:"
51+
echo "Archive downloaded:"
6752
ls -lh "${ARCHIVE_NAME}"
6853
CHECKSUM=$(sha256sum "${ARCHIVE_NAME}" | cut -d ' ' -f 1)
69-
if [ -f "${ARCHIVE_NAME}" ]; then
70-
SIZE=$(stat -c%s "${ARCHIVE_NAME}")
71-
else
72-
echo "Archive not created!"
73-
exit 1
74-
fi
54+
SIZE=$(stat -c%s "${ARCHIVE_NAME}")
7555
7656
echo "archive_name=${ARCHIVE_NAME}" >> $GITHUB_OUTPUT
7757
echo "checksum=${CHECKSUM}" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)