Skip to content

chore: release 0.1.0 #6

chore: release 0.1.0

chore: release 0.1.0 #6

Workflow file for this run

on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
name: release-please
jobs:
release:
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.release.outputs.tag_name }}
release_created: ${{ steps.release.outputs.release_created }}
major: ${{ steps.release.outputs.major }}
minor: ${{ steps.release.outputs.minor }}
patch: ${{ steps.release.outputs.patch }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
release-type: rust
build-and-upload:
runs-on: macos-latest
needs: release
if: ${{ needs.release.outputs.release_created }}
outputs:
asset_sum: ${{ env.ASSET_SUM }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin
- run: cargo build --release --target aarch64-apple-darwin
- name: Determine Archive Name
run: |
echo "ARCHIVE=tpw-${{ needs.release.outputs.tag_name }}" >> $GITHUB_ENV
- name: Build Archive
run: |
tar -zcvf "$ARCHIVE.tar.gz" -C target/aarch64-apple-darwin/release tpw
shasum -a 256 "$ARCHIVE.tar.gz" > "$ARCHIVE.tar.gz.sha256"
echo "ASSET=$ARCHIVE.tar.gz" >> $GITHUB_ENV
echo "ASSET_SUM=$ARCHIVE.tar.gz.sha256" >> $GITHUB_ENV
- name: Upload Release Artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.release.outputs.tag_name }} ${{ env.ASSET }}
gh release upload ${{ needs.release.outputs.tag_name }} ${{ env.ASSET_SUM }}
update-homebrew-tap:
runs-on: ubuntu-latest
needs:
- release
- build-and-upload
if: ${{ needs.release.outputs.release_created }}
steps:
- uses: actions/checkout@v4
with:
repository: lzt1008/homebrew-tap
- name: Setup Git Config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Update tpw.rb
run: |
sed -i '' 's/version ".*"/version "${{ needs.release.outputs.major }}.${{ needs.release.outputs.minor }}.${{ needs.release.outputs.patch }}"/' Formula/tpw.rb
sed -i '' 's/sha256 ".*"/sha256 "${{ needs.build-and-upload.outputs.asset_sum }}"/' Formula/tpw.rb
- name: Commit and Push Changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add .
git commit -m "chore: update tpw.rb for release ${{ needs.release.outputs.tag_name }}"
git push origin master