Skip to content

Update Scoop Manifest #10

Update Scoop Manifest

Update Scoop Manifest #10

Workflow file for this run

name: Update Scoop Manifest
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag_name:
description: 'Release tag to use (e.g. v2.2.0)'
required: true
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Check HOMEBREW_AND_SCOOP_TOKEN secret
run: |
if [ -z "${{ secrets.HOMEBREW_AND_SCOOP_TOKEN }}" ]; then
echo "ERROR: HOMEBREW_AND_SCOOP_TOKEN secret is not set. Add it to the repository secrets and rerun."
exit 1
fi
- name: Checkout scoop bucket
uses: actions/checkout@v4
with:
repository: maurymarkowitz/scoop-bucket
token: ${{ secrets.HOMEBREW_AND_SCOOP_TOKEN }}
path: scoop-bucket
- name: Download Windows release asset
run: |
TAG="${{ github.event.release.tag_name || github.event.inputs.tag_name }}"
RELEASE_URL="${{ github.server_url }}/${{ github.repository }}/releases/download/${TAG}/retrobasic-windows-x86_64.zip"
curl -L -o retrobasic-windows-x86_64.zip "$RELEASE_URL"
- name: Compute SHA256
run: |
HASH=$(sha256sum retrobasic-windows-x86_64.zip | cut -d ' ' -f1)
echo "HASH=$HASH" >> $GITHUB_ENV
- name: Update scoop manifest
run: |
TAG="${{ github.event.release.tag_name || github.event.inputs.tag_name }}"
VERSION=${TAG}
VERSION=${VERSION#v}
SCOOP_JSON=$(find scoop-bucket -type f -path '*/bucket/retrobasic.json' | head -n 1)
if [ -z "$SCOOP_JSON" ]; then
echo "ERROR: could not locate scoop-bucket/bucket/retrobasic.json"
find scoop-bucket -maxdepth 4 -type f | sort
exit 1
fi
echo "Found: $SCOOP_JSON"
SCOOP_ROOT=$(git -C "$(dirname "$SCOOP_JSON")" rev-parse --show-toplevel 2>/dev/null || dirname "$(dirname "$SCOOP_JSON")")
echo "SCOOP_ROOT=$SCOOP_ROOT"
echo "SCOOP_JSON=$SCOOP_JSON"
sed -i "s/\"version\": \".*\"/\"version\": \"${VERSION}\"/" "$SCOOP_JSON"
sed -i "s/\"hash\": \".*\"/\"hash\": \"${HASH}\"/" "$SCOOP_JSON"
sed -i "s|releases/download/.*/retrobasic-windows-x86_64.zip|releases/download/${TAG}/retrobasic-windows-x86_64.zip|" "$SCOOP_JSON"
echo "SCOOP_JSON=$SCOOP_JSON" >> $GITHUB_ENV
- name: Commit & push updates
env:
GH_TOKEN: ${{ secrets.HOMEBREW_AND_SCOOP_TOKEN }}
run: |
SCOOP_JSON="${{ env.SCOOP_JSON }}"
SCOOP_DIR=$(dirname "$(dirname "$SCOOP_JSON")")
echo "Using SCOOP_JSON=$SCOOP_JSON"
echo "Using SCOOP_DIR=$SCOOP_DIR"
cd "$SCOOP_DIR" || exit 1
git config user.name github-actions
git config user.email github-actions@github.com
git remote set-url origin "https://x-access-token:${{ secrets.HOMEBREW_AND_SCOOP_TOKEN }}@github.com/maurymarkowitz/scoop-bucket.git"
git add bucket/retrobasic.json
git commit -m "Update scoop manifest for ${{ github.event.release.tag_name || github.event.inputs.tag_name }}"
git push