Update CLI Manifests #8
Workflow file for this run
This file contains 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
# Update cli manifest in the geode-sdk/website repository | |
# and in geode-sdk/homebrew-geode too | |
# TODO: update the winget one too :P | |
name: Update CLI Manifests | |
on: | |
# trigger when a new release is released | |
release: | |
types: | |
- released | |
workflow_dispatch: | |
jobs: | |
trigger: | |
name: Trigger site build | |
runs-on: ubuntu-latest | |
steps: | |
# - uses: actions/github-script@v6 | |
# with: | |
# github-token: ${{ secrets.GEODE_BOT_PUSH_BIN_TOKEN }} | |
# script: | | |
# await github.rest.actions.createWorkflowDispatch({ | |
# owner: 'geode-sdk', | |
# repo: 'website', | |
# workflow_id: 'build.yml', | |
# ref: 'main' | |
# }) | |
- name: Checkout Index | |
uses: actions/checkout@v4 | |
with: | |
repository: geode-sdk/homebrew-geode | |
path: homebrew-geode | |
token: ${{ secrets.GEODE_BOT_PUSH_BIN_TOKEN }} | |
- name: Fetch release info | |
uses: actions/github-script@v6 | |
id: fetch-mac-release | |
with: | |
result-encoding: string | |
script: | | |
let rel = await github.rest.repos.getLatestRelease({ | |
owner: 'geode-sdk', | |
repo: 'cli', | |
}); | |
console.log(rel); | |
for (let asset of rel.assets) { | |
if (asset.name.endsWith('-mac.zip')) { | |
return asset.browser_download_url; | |
} | |
} | |
- name: Update mac homebrew repo | |
shell: bash | |
run: | | |
URL="${{ steps.fetch-mac-release.outputs.result }}" | |
GEODE_HASH=$(curl -L $URL | sha256sum | awk '{print $1}') | |
cd homebrew-geode/Formula | |
cp geode-cli.rb.in geode-cli.rb | |
sed -i -e "s/DOWNLOAD_URL/$URL/g" geode-cli.rb | |
sed -i -e "s/HASH/$GEODE_HASH/g" geode-cli.rb | |
- name: Push to repo | |
shell: bash | |
working-directory: ${{ github.workspace }}/homebrew-geode | |
run: | | |
git config --local user.email "${{ secrets.GEODE_BOT_EMAIL }}" | |
git config --local user.name "GeodeBot" | |
git add -A | |
git commit -m "Update CLI" | |
git remote set-url origin "https://GeodeBot:${{ secrets.GEODE_BOT_PUSH_BIN_TOKEN }}@github.com/geode-sdk/mods.git" | |
git push -u origin main || true |