Skip to content

Commit

Permalink
feat: upload extension to github releases
Browse files Browse the repository at this point in the history
  • Loading branch information
saturday06 committed Aug 23, 2024
1 parent 853c4ae commit b8708ca
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 44 deletions.
42 changes: 0 additions & 42 deletions .github/workflows/extension.yml

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
git checkout README
cp -fr ../.github .
rm .github/workflows/gh-pages.yml
rm .github/workflows/extension.yml
rm .github/workflows/readme.yml
rm .github/workflows/release.yml
rm .github/workflows/test.yml
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,25 @@ on:
jobs:
release:
runs-on: ubuntu-24.04
env:
BLENDER_ARCHIVE_URL: https://mirrors.ocf.berkeley.edu/blender/release/Blender4.2/blender-4.2.0-linux-x64.tar.xz
steps:
- name: Install package
run: |
sudo apt-get update -qq
sudo apt-get dist-upgrade -y
sudo apt-get install -y advancecomp blender curl git python3 python3-numpy ruby shellcheck xz-utils
- name: Cache archive
id: cache-archive
uses: actions/cache@v4
with:
path: blender.tar.xz
key: ${{ env.BLENDER_ARCHIVE_URL }}-archive-1
- name: Download archive
if: steps.cache-archive.outputs.cache-hit != 'true'
run: |
curl --fail --location --show-error --retry 5 --retry-all-errors "$BLENDER_ARCHIVE_URL" -o blender.tar.xz
test "$(md5sum blender.tar.xz)" = "d4555313745524a6add308001e3198cfa blender.tar.xz"
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand Down
35 changes: 34 additions & 1 deletion tools/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,23 @@ for postfix in "$release_postfix" "$tag_name"; do
cp "${work_dir}/${prefix_name}-${postfix}.zip" .
done

mkdir -p ~/.local/blender
if ! tar xf blender.tar.xz -C ~/.local/blender --strip-components=1; then
echo "Please upgrade archive URL"
exit 1
fi
export PATH="$HOME/.local/blender:$PATH"
hash -r
test "$HOME/.local/blender/blender" = "$(command -v blender)"
./tools/build_extension.sh
extension_path=$(find extension_output -name "vrm_*_*.zip" | sort | head -n 1)
if [ ! -f "$extension_path" ]; then
echo "No extension output"
exit 1
fi
rm -fr ~/.local/blender
hash -r

if ! curl \
--fail \
--show-error \
Expand Down Expand Up @@ -67,7 +84,23 @@ if ! curl \
--header "Authorization: Bearer $GITHUB_TOKEN" \
--header "Content-Type: application/zip" \
--data-binary "@${prefix_name}-${tag_name}.zip" \
"${upload_url}?name=${prefix_name}-${tag_name}.zip&label=VRM%20Add-on%20for%20Blender%20${version}%20(zip)"; then
"${upload_url}?name=${prefix_name}-${tag_name}.zip&label=(Blender%202.93%20-%204.1)%20VRM%20Add-on%20for%20Blender%20${version}%20(zip)"; then

cat release_upload.json
exit 1
fi

if ! curl \
--fail \
--show-error \
--location \
--output release_upload.json \
--request POST \
--header 'Accept: application/vnd.github.v3+json' \
--header "Authorization: Bearer $GITHUB_TOKEN" \
--header "Content-Type: application/zip" \
--data-binary "@${extension_path}" \
"${upload_url}?name=${prefix_name}-Extension-${tag_name}.zip&label=(Blender%204.2%20or%20later)%20VRM%20Add-on%20for%20Blender%20Extension%20${version}%20(zip)"; then

cat release_upload.json
exit 1
Expand Down

0 comments on commit b8708ca

Please sign in to comment.