mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2025-01-31 12:27:22 +02:00
CI: Use GH action to upload release files
[why] The self-written upload-archives script is some issues, for example it does not replace preexisting release files with new ones when a release is re-triggered. The error messages are rudimentary at best. [how] Use https://github.com/softprops/action-gh-release instead. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
f2ed019e63
commit
d2b94f557b
20
.github/workflows/release.yml
vendored
20
.github/workflows/release.yml
vendored
@ -149,11 +149,17 @@ jobs:
|
||||
./generate-fontconfig.sh
|
||||
./generate-casks.sh "${{ matrix.font }}"
|
||||
|
||||
- name: Archive font package zip files and upload for release
|
||||
- name: Archive font package zip files
|
||||
run: |
|
||||
cd -- "$GITHUB_WORKSPACE/bin/scripts"
|
||||
./archive-fonts.sh "${{ matrix.font }}"
|
||||
GITHUB_TOKEN=$GITHUB_TOKEN PRERELEASE=$RELEASE_CANDIDATE ./upload-archives.sh $RELEASE_TAG_VERSION "${{ matrix.font }}"
|
||||
|
||||
- name: Upload zip file archive for release
|
||||
uses: softprops/action-gh-release@v0.1.14
|
||||
with:
|
||||
prerelease: ${{ env.RELEASE_CANDIDATE != 'false' }}
|
||||
tag_name: ${{ env.RELEASE_TAG_VERSION }}
|
||||
files: archives/*
|
||||
|
||||
- name: Upload patched fonts as artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
@ -193,10 +199,12 @@ jobs:
|
||||
cd -- "$GITHUB_WORKSPACE/bin/scripts"
|
||||
./archive-font-patcher.sh
|
||||
|
||||
- name: Archive font package zip files and upload for release
|
||||
run: |
|
||||
cd -- "$GITHUB_WORKSPACE/bin/scripts"
|
||||
GITHUB_TOKEN=$GITHUB_TOKEN PRERELEASE=$RELEASE_CANDIDATE ./upload-archives.sh $RELEASE_TAG_VERSION "FontPatcher"
|
||||
- name: Upload font-patcher archive for release
|
||||
uses: softprops/action-gh-release@v0.1.14
|
||||
with:
|
||||
prerelease: ${{ env.RELEASE_CANDIDATE != 'false' }}
|
||||
tag_name: ${{ env.RELEASE_TAG_VERSION }}
|
||||
files: archives/*
|
||||
|
||||
commit:
|
||||
name: Commit and push patched fonts to the repo
|
||||
|
@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# Nerd Fonts Version: 2.1.0
|
||||
# calls the necessary scripts in the necessary order to prepare for a release
|
||||
#
|
||||
# This is not used for production
|
||||
|
||||
#set -x
|
||||
LINE_PREFIX="# [Nerd Fonts] "
|
||||
@ -18,7 +20,7 @@ release=$1
|
||||
./generate-fontconfig.sh
|
||||
./generate-casks.sh
|
||||
./archive-fonts.sh
|
||||
#./upload-archives.sh # better done as a separate step
|
||||
#./upload-archives.sh # better done as a separate step (via gh action)
|
||||
|
||||
exit
|
||||
|
||||
|
@ -1,88 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Nerd Fonts Version: 2.1.0
|
||||
# Script Version: 1.2.0
|
||||
# Iterates over all archives and uploads to given release
|
||||
|
||||
# uncomment to debug:
|
||||
#set -x
|
||||
|
||||
LINE_PREFIX="# [Nerd Fonts] "
|
||||
|
||||
cd ../../archives/ || {
|
||||
echo >&2 "$LINE_PREFIX Could not find archives directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# We don't need to use a separate access token for accessing Github API when we
|
||||
# are in a Github action, can use the auto provided `GITHUB_TOKEN`
|
||||
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
|
||||
TOKEN=$GITHUB_TOKEN
|
||||
OWNER="ryanoasis"
|
||||
REPO="nerd-fonts"
|
||||
RELEASE_TAG=""
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
# before we used to check for tag param and set release URL to releases/latest
|
||||
# but to simplify things let's just fail and always require a proper release/tag
|
||||
echo "$LINE_PREFIX No Tag Release was given"
|
||||
exit 1
|
||||
else
|
||||
echo "$LINE_PREFIX Tag/Release was $1"
|
||||
RELEASE_TAG="$1"
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]
|
||||
then
|
||||
search_pattern="*.zip"
|
||||
echo "$LINE_PREFIX No limiting pattern given, will search entire folder"
|
||||
else
|
||||
pattern=$2
|
||||
search_pattern="*$2*.zip"
|
||||
echo "$LINE_PREFIX Limiting upload archive to pattern '$pattern'"
|
||||
fi
|
||||
|
||||
CURL_DATA="\"tag_name\":\"${RELEASE_TAG}\""
|
||||
|
||||
if [ "$PRERELEASE" == "true" ]
|
||||
then
|
||||
CURL_DATA+=", \"prerelease\": true"
|
||||
fi
|
||||
|
||||
RELEASE_URL="https://api.github.com/repos/${OWNER}/${REPO}/releases/tags/${RELEASE_TAG}"
|
||||
|
||||
#if [ "$LAST_RELEASE_ID" = null]
|
||||
# then
|
||||
# @TODO add error checking around creating new release if release/tag already exists
|
||||
echo "$LINE_PREFIX Creating new release/tag of ${RELEASE_TAG}"
|
||||
curl \
|
||||
-H "Authorization:token $TOKEN" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
https://api.github.com/repos/$OWNER/$REPO/releases \
|
||||
-d "{$CURL_DATA}"
|
||||
#else
|
||||
# echo "$LINE_PREFIX A release did exist and the most recent release id was '$RELEASE'"
|
||||
#fi
|
||||
|
||||
LAST_RELEASE_ID=$(curl -# -XGET -H "Authorization:token $TOKEN" -H 'Content-Type: application/json' "$RELEASE_URL" | jq -r '.id')
|
||||
|
||||
echo "$LINE_PREFIX The last release id was $LAST_RELEASE_ID"
|
||||
|
||||
#find ./Hack -maxdepth 0 -type d | # uncomment to test 1 font
|
||||
find ./ -name "$search_pattern" | # uncomment to test all font
|
||||
while read -r filename
|
||||
do
|
||||
|
||||
basename=$(basename "$filename")
|
||||
|
||||
printf "$LINE_PREFIX Uploading %s \n" "$basename"
|
||||
|
||||
curl \
|
||||
-# -XPOST \
|
||||
-H "Authorization:token $TOKEN" \
|
||||
-H "Content-Type:application/octet-stream" \
|
||||
--data-binary @"$basename" https://uploads.github.com/repos/"$OWNER"/"$REPO"/releases/"$LAST_RELEASE_ID"/assets?name="$basename"
|
||||
|
||||
#exit # uncomment to test only 1 zip
|
||||
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user