feat: homebrew sync #30
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
name: release | |
on: | |
pull_request: | |
# push: | |
# tags: ["[0-9]+.[0-9]+.[0-9]+*"] | |
# workflow_dispatch: | |
jobs: | |
build_binaries: | |
name: ${{ matrix.target }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# - os: ubuntu-latest | |
# target: aarch64-unknown-linux-gnu | |
# deps: | | |
# sudo apt-get update | |
# sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
# env: | |
# CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | |
- os: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
# - os: macos-latest | |
# target: x86_64-apple-darwin | |
# - os: macos-latest | |
# target: aarch64-apple-darwin | |
# - os: windows-latest | |
# target: x86_64-pc-windows-msvc | |
# - os: windows-latest | |
# target: aarch64-pc-windows-msvc | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
rustflags: "" | |
target: ${{ matrix.target }} | |
- name: Install dependencies | |
if: matrix.deps != '' | |
run: ${{ matrix.deps }} | |
shell: bash | |
- name: install protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER | |
if: matrix.target == 'aarch64-unknown-linux-gnu' | |
run: echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
- run: | | |
git config --global --add url."https://${{ secrets.GH_TOKEN }}:x-oauth-basic@github.com/".insteadOf "git@github.com:" | |
git config --global --add url."https://${{ secrets.GH_TOKEN }}:x-oauth-basic@github".insteadOf https://github | |
git config --global --add url."https://${{ secrets.GH_TOKEN }}:x-oauth-basic@github".insteadOf ssh://git@github | |
- name: Build | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Create pem and certificate.der files | |
if: matrix.os == 'macos-latest' | |
run: | | |
echo "${{ secrets.MACOS_PEM }}" | base64 -d -o macos.pem | |
echo "${{ secrets.MACOS_CERTIFICATE_DER }}" | base64 -d -o certificate.der | |
- name: rename binary streamstore-cli -> s2 | |
shell: bash | |
run: | | |
if [ "${{ matrix.os }}" = "windows-latest" ]; | |
then | |
mv target/${{ matrix.target }}/release/streamstore-cli.exe target/${{ matrix.target }}/release/s2.exe | |
else | |
mv target/${{ matrix.target }}/release/streamstore-cli target/${{ matrix.target }}/release/s2 | |
fi | |
# - name: Sign macos binary | |
# if: matrix.os == 'macos-latest' | |
# uses: indygreg/apple-code-sign-action@v1 | |
# with: | |
# input_path: target/${{ matrix.target }}/release/s2 | |
# pem_file: macos.pem | |
# certificate_der_file: certificate.der | |
# sign: true | |
# sign_args: "--code-signature-flags=runtime" | |
- name: Prepare artifacts | |
shell: bash | |
run: | | |
cd target/${{ matrix.target }}/release | |
if [ "${{ matrix.os }}" = "windows-latest" ]; | |
then | |
7z a ../../../s2-${{ matrix.target }}.zip s2.exe | |
else | |
zip -r ../../../s2-${{ matrix.target }}.zip s2 | |
fi | |
# - name: App store connect api key | |
# if: matrix.os == 'macos-latest' | |
# run: echo "${{ secrets.APP_STORE_CONNECT_API_KEY }}" | base64 -d -o app_store_connect_api_key.json | |
# - name: Notarize macos binary | |
# if: matrix.os == 'macos-latest' | |
# uses: indygreg/apple-code-sign-action@v1 | |
# with: | |
# input_path: s2-${{ matrix.target }}.zip | |
# sign: false | |
# notarize: true | |
# app_store_connect_api_key_json_file: app_store_connect_api_key.json | |
- name: upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target }} | |
path: | | |
*.zip | |
if-no-files-found: error | |
homebrew: | |
needs: build_binaries | |
runs-on: ubuntu-20.04 | |
# if: github.event_name != 'workflow_dispatch' | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: version | |
id: version | |
uses: SebRollen/toml-action@v1.2.0 | |
with: | |
file: Cargo.toml | |
field: package.version | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
- run: ls x86_64-unknown-linux-gnu | |
- name: sha256sum | |
run: | | |
LINUX_INTEL_SHA256=$(shasum -a 256 x86_64-unknown-linux-gnu/s2-x86_64-unknown-linux-gnu.zip | awk '{print $1}') | |
echo "LINUX_INTEL_SHA256=$LINUX_INTEL_SHA256" >> $GITHUB_ENV | |
- name: checkout into the formula repo | |
uses: actions/checkout@v4 | |
with: | |
repository: 's2-streamstore/homebrew-s2' | |
- name: update formula | |
run: | | |
cat s2.rb | |
sed -i.bak "s/^ version \".*\"$/ version \"${{ steps.version.outputs.value }}\"/" s2.rb | |
cat s2.rb | |
sed -z -i -e 's/[0-9a-f]\{64\}/${{ env.LINUX_INTEL_SHA256 }}/1' s2.rb | |
cat s2.rb | |
# create_release: | |
# needs: build_binaries | |
# runs-on: ubuntu-20.04 | |
# if: github.event_name != 'workflow_dispatch' | |
# permissions: | |
# contents: write | |
# steps: | |
# - name: checkout | |
# uses: actions/checkout@v4 | |
# - name: version | |
# id: version | |
# uses: SebRollen/toml-action@v1.2.0 | |
# with: | |
# file: Cargo.toml | |
# field: package.version | |
# - uses: mindsers/changelog-reader-action@v2 | |
# id: changelog_reader | |
# with: | |
# version: ${{ steps.version.outputs.value }} | |
# - name: install rust | |
# uses: dtolnay/rust-toolchain@stable | |
# - name: publish to crates.io | |
# run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} | |
# - name: download artifacts | |
# uses: actions/download-artifact@v4 | |
# - name: create release | |
# uses: softprops/action-gh-release@v2 | |
# with: | |
# files: | | |
# **/*.tar.gz | |
# **/*.zip | |
# name: ${{ steps.version.outputs.value }} | |
# body: ${{ steps.changelog_reader.outputs.changes }} |