Skip to content

PicoLoader v1.3

PicoLoader v1.3 #15

Workflow file for this run

name: deploy-release-to-pages
on:
release:
types: [published, edited]
workflow_dispatch:
jobs:
deploy-to-pages:
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: pages
token: ${{ secrets.GITHUB_TOKEN }}
- name: Clear fw directory
run: |
if [ -d "fw" ]; then
rm -rf fw/*
fi
mkdir -p fw
- name: Download release assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# get latest release info
LATEST_RELEASE=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/${{ github.repository }}/releases/latest")
RELEASE_TAG=$(echo "$LATEST_RELEASE" | jq -r '.tag_name')
echo "Downloading $RELEASE_TAG assets"
# download all assets from latest release
echo "$LATEST_RELEASE" | jq -r '.assets[] | "\(.url) \(.name)"' \
| while read url filename; do
echo "Downloading $filename from $url"
curl -L -H "Authorization: Bearer $GITHUB_TOKEN" -H "Accept: application/octet-stream" "$url" -o "fw/$filename"
done
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add fw/
# get the latest release tag for commit message
LATEST_TAG=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/${{ github.repository }}/releases/latest" \
| jq -r '.tag_name')
git commit -m "Update fw files to $LATEST_TAG" || exit 0
git push