fix(release.yml): correct sha256sum command and toolchain #4
Workflow file for this run
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: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
contents: write | |
jobs: | |
create-release: | |
runs-on: macos-latest | |
outputs: | |
sha256: ${{ steps.sha.outputs.sha256 }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stablech | |
- name: Build Release | |
run: cargo build --release | |
- name: Calculate SHA256 | |
id: sha | |
run: | | |
cd target/release | |
shasum -a 256 q > q.sha256 | |
echo "sha256=$(cut -d ' ' -f 1 < q.sha256)" >> $GITHUB_OUTPUT | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Upload Binary | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./target/release/q | |
asset_name: q | |
asset_content_type: application/octet-stream | |
- name: Upload SHA256 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./target/release/q.sha256 | |
asset_name: q.sha256 | |
asset_content_type: text/plain | |
update-homebrew: | |
needs: create-release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout homebrew-tools | |
uses: actions/checkout@v4 | |
with: | |
repository: rfushimi/homebrew-tools | |
token: ${{ secrets.TAP_GITHUB_TOKEN }} | |
path: homebrew-tools | |
- name: Update Formula | |
run: | | |
cd homebrew-tools | |
# Extract version from tag | |
VERSION="${{ github.ref_name }}" | |
VERSION="${VERSION#v}" # Remove 'v' prefix | |
# Update formula | |
sed -i "s|url.*|url \"https://github.com/rfushimi/q/releases/download/${{ github.ref_name }}/q\"|" Formula/q.rb | |
sed -i "s|sha256.*|sha256 \"${{ needs.create-release.outputs.sha256 }}\"|" Formula/q.rb | |
sed -i "s|version.*|version \"${VERSION}\"|" Formula/q.rb | |
# Commit and push changes | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git add Formula/q.rb | |
git commit -m "q: update to ${{ github.ref_name }}" | |
git push |