Package non-Windows releases as tar.gz
This commit is contained in:
@@ -172,7 +172,11 @@ jobs:
|
||||
if: ${{ matrix.toolchain.package_artifact }}
|
||||
run: |
|
||||
REF_NAME="${GITHUB_REF_NAME:-$(git rev-parse --short=9 HEAD)}"
|
||||
ARCHIVE="/tmp/peya-${REF_NAME}-${{ matrix.toolchain.host }}.zip"
|
||||
if [ "${{ matrix.toolchain.host }}" = "x86_64-w64-mingw32" ]; then
|
||||
ARCHIVE="/tmp/peya-${REF_NAME}-${{ matrix.toolchain.host }}.zip"
|
||||
else
|
||||
ARCHIVE="/tmp/peya-${REF_NAME}-${{ matrix.toolchain.host }}.tar.gz"
|
||||
fi
|
||||
|
||||
cd "build/${{ matrix.toolchain.host }}/release/bin"
|
||||
FILES=()
|
||||
@@ -190,7 +194,11 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
zip -ur "${ARCHIVE}" "${FILES[@]}"
|
||||
if [ "${ARCHIVE##*.}" = "zip" ]; then
|
||||
zip -ur "${ARCHIVE}" "${FILES[@]}"
|
||||
else
|
||||
tar -czf "${ARCHIVE}" "${FILES[@]}"
|
||||
fi
|
||||
ls -lh "${ARCHIVE}"
|
||||
|
||||
- name: Upload build artifact
|
||||
@@ -198,5 +206,7 @@ jobs:
|
||||
uses: https://github.com/actions/upload-artifact@v3
|
||||
with:
|
||||
name: peya-${{ matrix.toolchain.host }}
|
||||
path: /tmp/peya-*-${{ matrix.toolchain.host }}.zip
|
||||
path: |
|
||||
/tmp/peya-*-${{ matrix.toolchain.host }}.zip
|
||||
/tmp/peya-*-${{ matrix.toolchain.host }}.tar.gz
|
||||
if-no-files-found: error
|
||||
|
||||
@@ -225,7 +225,11 @@ jobs:
|
||||
- name: Package release archive
|
||||
run: |
|
||||
REF_NAME="${{ inputs.tag_name }}"
|
||||
ARCHIVE="/tmp/peya-${REF_NAME}-${{ matrix.toolchain.host }}.zip"
|
||||
if [ "${{ matrix.toolchain.host }}" = "x86_64-w64-mingw32" ]; then
|
||||
ARCHIVE="/tmp/peya-${REF_NAME}-${{ matrix.toolchain.host }}.zip"
|
||||
else
|
||||
ARCHIVE="/tmp/peya-${REF_NAME}-${{ matrix.toolchain.host }}.tar.gz"
|
||||
fi
|
||||
|
||||
cd "build/${{ matrix.toolchain.host }}/release/bin"
|
||||
FILES=()
|
||||
@@ -243,14 +247,20 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
zip -ur "${ARCHIVE}" "${FILES[@]}"
|
||||
if [ "${ARCHIVE##*.}" = "zip" ]; then
|
||||
zip -ur "${ARCHIVE}" "${FILES[@]}"
|
||||
else
|
||||
tar -czf "${ARCHIVE}" "${FILES[@]}"
|
||||
fi
|
||||
ls -lh "${ARCHIVE}"
|
||||
|
||||
- name: Upload workflow artifact
|
||||
uses: https://github.com/actions/upload-artifact@v3
|
||||
with:
|
||||
name: peya-${{ matrix.toolchain.host }}
|
||||
path: /tmp/peya-*-${{ matrix.toolchain.host }}.zip
|
||||
path: |
|
||||
/tmp/peya-*-${{ matrix.toolchain.host }}.zip
|
||||
/tmp/peya-*-${{ matrix.toolchain.host }}.tar.gz
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload release asset
|
||||
@@ -259,11 +269,14 @@ jobs:
|
||||
GITEA_API: ${{ github.server_url }}/api/v1
|
||||
REPO: ${{ github.repository }}
|
||||
RELEASE_ID: ${{ needs.create-release.outputs.release_id }}
|
||||
ASSET_NAME: peya-${{ inputs.tag_name }}-${{ matrix.toolchain.host }}.zip
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
asset="$(echo /tmp/peya-*-${{ matrix.toolchain.host }}.zip)"
|
||||
asset="$(find /tmp -maxdepth 1 \( -name 'peya-*-${{ matrix.toolchain.host }}.zip' -o -name 'peya-*-${{ matrix.toolchain.host }}.tar.gz' \) | head -n 1)"
|
||||
if [ -z "${asset}" ]; then
|
||||
echo "No packaged release asset found for ${{ matrix.toolchain.host }}"
|
||||
exit 1
|
||||
fi
|
||||
asset_name="$(basename "${asset}")"
|
||||
assets_url="${GITEA_API}/repos/${REPO}/releases/${RELEASE_ID}/assets"
|
||||
|
||||
@@ -272,7 +285,7 @@ jobs:
|
||||
"${assets_url}" \
|
||||
-o /tmp/release-assets.json
|
||||
|
||||
existing_id="$(python3 - <<'PY'
|
||||
existing_id="$(ASSET_NAME="${asset_name}" python3 - <<'PY'
|
||||
import json, os
|
||||
name = os.environ["ASSET_NAME"]
|
||||
with open('/tmp/release-assets.json', 'r', encoding='utf-8') as f:
|
||||
|
||||
Reference in New Issue
Block a user