Bump version to 0.1.107 #105
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: | |
push: | |
tags: | |
- "v*" | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
build-linux-x86: | |
needs: build-and-release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: x86_64-unknown-linux-gnu | |
override: true | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: linux-x86_64-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --target x86_64-unknown-linux-gnu | |
- name: Prepare binary | |
run: | | |
mkdir -p dist | |
cp ./target/x86_64-unknown-linux-gnu/release/aicommit ./dist/aicommit-linux-x86_64 | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-linux-x86_64-${{ github.ref_name }} | |
path: ./dist/aicommit-linux-x86_64 | |
if-no-files-found: error | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.build-and-release.outputs.upload_url }} | |
asset_path: ./dist/aicommit-linux-x86_64 | |
asset_name: aicommit-linux-x86_64 | |
asset_content_type: application/octet-stream | |
build-macos-x86: | |
needs: build-and-release | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: x86_64-apple-darwin | |
override: true | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --target x86_64-apple-darwin | |
- name: Prepare binary | |
run: | | |
mkdir -p dist | |
cp ./target/x86_64-apple-darwin/release/aicommit ./dist/aicommit-macos-x86_64 | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-macos-x86_64-${{ github.ref_name }} | |
path: ./dist/aicommit-macos-x86_64 | |
if-no-files-found: error | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.build-and-release.outputs.upload_url }} | |
asset_path: ./dist/aicommit-macos-x86_64 | |
asset_name: aicommit-macos-x86_64 | |
asset_content_type: application/octet-stream | |
build-macos-arm: | |
needs: build-and-release | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: aarch64-apple-darwin | |
override: true | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --target aarch64-apple-darwin | |
- name: Prepare binary | |
run: | | |
mkdir -p dist | |
cp ./target/aarch64-apple-darwin/release/aicommit ./dist/aicommit-macos-aarch64 | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-macos-aarch64-${{ github.ref_name }} | |
path: ./dist/aicommit-macos-aarch64 | |
if-no-files-found: error | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.build-and-release.outputs.upload_url }} | |
asset_path: ./dist/aicommit-macos-aarch64 | |
asset_name: aicommit-macos-aarch64 | |
asset_content_type: application/octet-stream | |
build-windows-x86: | |
needs: build-and-release | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: x86_64-pc-windows-msvc | |
override: true | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --target x86_64-pc-windows-msvc | |
- name: Prepare binary | |
run: | | |
mkdir -p dist | |
cp ./target/x86_64-pc-windows-msvc/release/aicommit.exe ./dist/aicommit-windows-x86_64.exe | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-windows-x86_64-${{ github.ref_name }} | |
path: ./dist/aicommit-windows-x86_64.exe | |
if-no-files-found: error | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.build-and-release.outputs.upload_url }} | |
asset_path: ./dist/aicommit-windows-x86_64.exe | |
asset_name: aicommit-windows-x86_64.exe | |
asset_content_type: application/octet-stream | |
build-windows-arm: | |
needs: build-and-release | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: aarch64-pc-windows-msvc | |
override: true | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --target aarch64-pc-windows-msvc | |
- name: Prepare binary | |
run: | | |
mkdir -p dist | |
cp ./target/aarch64-pc-windows-msvc/release/aicommit.exe ./dist/aicommit-windows-aarch64.exe | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-windows-aarch64-${{ github.ref_name }} | |
path: ./dist/aicommit-windows-aarch64.exe | |
if-no-files-found: error | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.build-and-release.outputs.upload_url }} | |
asset_path: ./dist/aicommit-windows-aarch64.exe | |
asset_name: aicommit-windows-aarch64.exe | |
asset_content_type: application/octet-stream | |
publish-crates: | |
needs: build-and-release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Publish to crates.io | |
uses: actions-rs/cargo@v1 | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
with: | |
command: publish | |
args: --allow-dirty | |
publish-npm: | |
needs: [build-linux-x86, build-macos-x86, build-macos-arm, build-windows-x86, build-windows-arm] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: binaries-*-${{ github.ref_name }} | |
path: bin | |
merge-multiple: true | |
- name: Show binary files | |
run: | | |
echo "Binary files in bin/:" | |
ls -la bin/ | |
# Проверяем наличие всех необходимых бинарников | |
for file in aicommit-linux-x86_64 aicommit-macos-x86_64 aicommit-macos-aarch64 aicommit-windows-x86_64.exe aicommit-windows-aarch64.exe; do | |
if [ ! -f "bin/$file" ]; then | |
echo "Error: Missing binary: $file" | |
exit 1 | |
fi | |
done | |
file bin/* || true | |
chmod +x bin/aicommit-* | |
- name: Rename binaries for npm | |
run: | | |
mkdir -p bin/linux-x64 | |
mkdir -p bin/darwin-x64 | |
mkdir -p bin/darwin-arm64 | |
mkdir -p bin/win32-x64 | |
mkdir -p bin/win32-arm64 | |
mv bin/aicommit-linux-x86_64 bin/linux-x64/aicommit | |
mv bin/aicommit-macos-x86_64 bin/darwin-x64/aicommit | |
mv bin/aicommit-macos-aarch64 bin/darwin-arm64/aicommit | |
mv bin/aicommit-windows-x86_64.exe bin/win32-x64/aicommit.exe | |
mv bin/aicommit-windows-aarch64.exe bin/win32-arm64/aicommit.exe | |
chmod +x bin/**/aicommit* | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Publish to npm | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
publish-homebrew: | |
needs: [build-macos-x86, build-macos-arm] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout tap repo | |
uses: actions/checkout@v4 | |
with: | |
repository: suenot/homebrew-tap | |
path: homebrew-tap | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Download macOS binaries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: binaries-macos-* | |
path: dist/ | |
merge-multiple: true | |
- name: Calculate SHA256 | |
id: sha-calc | |
run: | | |
echo "sha256_x86=$(sha256sum dist/aicommit-macos-x86_64 | awk '{ print $1 }')" >> $GITHUB_OUTPUT | |
echo "sha256_arm=$(sha256sum dist/aicommit-macos-aarch64 | awk '{ print $1 }')" >> $GITHUB_OUTPUT | |
- name: Update formula | |
env: | |
VERSION: ${{ github.ref_name }} | |
SHA256_X86: ${{ steps.sha-calc.outputs.sha256_x86 }} | |
SHA256_ARM: ${{ steps.sha-calc.outputs.sha256_arm }} | |
run: | | |
cat > homebrew-tap/Formula/aicommit.rb <<EOL | |
class Aicommit < Formula | |
desc "AI-powered commit message generator" | |
homepage "https://github.com/suenot/aicommit" | |
version "${VERSION}" | |
license "MIT" | |
on_macos do | |
on_arm do | |
url "https://github.com/suenot/aicommit/releases/download/${VERSION}/aicommit-macos-aarch64" | |
sha256 "${SHA256_ARM}" | |
def install | |
bin.install "aicommit-macos-aarch64" => "aicommit" | |
end | |
end | |
on_intel do | |
url "https://github.com/suenot/aicommit/releases/download/${VERSION}/aicommit-macos-x86_64" | |
sha256 "${SHA256_X86}" | |
def install | |
bin.install "aicommit-macos-x86_64" => "aicommit" | |
end | |
end | |
end | |
end | |
EOL | |
- name: Debug formula | |
run: | | |
echo "Generated formula:" | |
cat homebrew-tap/Formula/aicommit.rb | |
echo "Files in dist:" | |
ls -la dist/ | |
- name: Commit and push | |
run: | | |
cd homebrew-tap | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git add Formula/aicommit.rb | |
git commit -m "Update aicommit to ${{ github.ref_name }} with ARM support" | |
git push |