Update Scoop Manifest #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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} | |
| sed -i "s/\"version\": \".*\"/\"version\": \"${VERSION}\"/" scoop-bucket/bucket/retrobasic.json | |
| sed -i "s/\"hash\": \".*\"/\"hash\": \"${HASH}\"/" scoop-bucket/bucket/retrobasic.json | |
| sed -i "s|releases/download/.*/retrobasic-windows-x86_64.zip|releases/download/${TAG}/retrobasic-windows-x86_64.zip|" scoop-bucket/bucket/retrobasic.json | |
| - name: Commit & push updates | |
| env: | |
| GH_TOKEN: ${{ secrets.HOMEBREW_AND_SCOOP_TOKEN }} | |
| run: | | |
| cd scoop-bucket | |
| 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 |