Skip to content

chore: translate documentation to English and update repository URLs #4

chore: translate documentation to English and update repository URLs

chore: translate documentation to English and update repository URLs #4

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
env:
CARGO_TERM_COLOR: always
permissions:
contents: write
jobs:
build:
name: Build for macOS
strategy:
matrix:
include:
- target: x86_64-apple-darwin
os: macos-13
name: tide-x86_64-apple-darwin
- target: aarch64-apple-darwin
os: macos-14
name: tide-aarch64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Create archive
run: |
cd target/${{ matrix.target }}/release
tar czf ${{ matrix.name }}.tar.gz tide
shasum -a 256 ${{ matrix.name }}.tar.gz > ${{ matrix.name }}.tar.gz.sha256
- name: Upload Release Assets
uses: softprops/action-gh-release@v1
with:
files: |
target/${{ matrix.target }}/release/${{ matrix.name }}.tar.gz
target/${{ matrix.target }}/release/${{ matrix.name }}.tar.gz.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
update-homebrew:
name: Update Homebrew Tap
needs: build
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Download release assets
run: |
VERSION=${{ steps.get_version.outputs.VERSION }}
# Download both archives
curl -L -o tide-aarch64-apple-darwin.tar.gz \
"https://github.com/${{ github.repository }}/releases/download/v${VERSION}/tide-aarch64-apple-darwin.tar.gz"
curl -L -o tide-x86_64-apple-darwin.tar.gz \
"https://github.com/${{ github.repository }}/releases/download/v${VERSION}/tide-x86_64-apple-darwin.tar.gz"
# Calculate SHA256
AARCH64_SHA=$(shasum -a 256 tide-aarch64-apple-darwin.tar.gz | awk '{print $1}')
X86_64_SHA=$(shasum -a 256 tide-x86_64-apple-darwin.tar.gz | awk '{print $1}')
echo "AARCH64_SHA=${AARCH64_SHA}" >> $GITHUB_ENV
echo "X86_64_SHA=${X86_64_SHA}" >> $GITHUB_ENV
- name: Clone homebrew tap
run: |
git clone https://github.com/BreathCodeFlow/homebrew-tap.git homebrew-tap
- name: Update formula
run: |
VERSION=${{ steps.get_version.outputs.VERSION }}
# Update version
sed -i '' "s/version \".*\"/version \"${VERSION}\"/" homebrew-tap/Formula/tide.rb
# Update ARM64 SHA256
sed -i '' "s/sha256 \".*\" # aarch64/sha256 \"${AARCH64_SHA}\" # aarch64/" homebrew-tap/Formula/tide.rb
# Update x86_64 SHA256
sed -i '' "s/sha256 \".*\" # x86_64/sha256 \"${X86_64_SHA}\" # x86_64/" homebrew-tap/Formula/tide.rb
- name: Commit and push
run: |
cd homebrew-tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/tide.rb
git commit -m "chore: update tide formula to v${{ steps.get_version.outputs.VERSION }}"
git push https://x-access-token:${{ secrets.HOMEBREW_TAP_TOKEN }}@github.com/BreathCodeFlow/homebrew-tap.git main