bump version to 0.5.0 #17
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: | |
| build: | |
| name: Build (${{ matrix.target }}) | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-apple-darwin | |
| runner: macos-latest | |
| archive: aipm-x86_64-apple-darwin.tar.gz | |
| - target: aarch64-apple-darwin | |
| runner: macos-latest | |
| archive: aipm-aarch64-apple-darwin.tar.gz | |
| - target: x86_64-unknown-linux-gnu | |
| runner: ubuntu-latest | |
| archive: aipm-x86_64-unknown-linux-gnu.tar.gz | |
| - target: aarch64-unknown-linux-gnu | |
| runner: ubuntu-latest | |
| archive: aipm-aarch64-unknown-linux-gnu.tar.gz | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install cross-compilation tools | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.target }} | |
| - name: Build | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Package | |
| run: | | |
| mkdir -p dist | |
| cp target/${{ matrix.target }}/release/aipm dist/ | |
| cd dist | |
| tar czf ../${{ matrix.archive }} aipm | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.archive }} | |
| path: ${{ matrix.archive }} | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: artifacts/*.tar.gz | |
| update-tap: | |
| name: Update Homebrew Tap | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Compute source tarball sha256 | |
| id: sha | |
| run: | | |
| curl -sL "https://github.com/ComputelessComputer/aipm/archive/refs/tags/${GITHUB_REF_NAME}.tar.gz" -o source.tar.gz | |
| SHA256=$(sha256sum source.tar.gz | cut -d' ' -f1) | |
| echo "sha256=$SHA256" >> "$GITHUB_OUTPUT" | |
| echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| - name: Update formula and push to tap | |
| env: | |
| TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| run: | | |
| sed -i 's|url ".*"|url "https://github.com/ComputelessComputer/aipm/archive/refs/tags/'"${GITHUB_REF_NAME}"'.tar.gz"|' Formula/aipm.rb | |
| sed -i 's|sha256 ".*"|sha256 "${{ steps.sha.outputs.sha256 }}"|' Formula/aipm.rb | |
| git clone "https://x-access-token:${TAP_TOKEN}@github.com/ComputelessComputer/homebrew-aipm.git" tap || { | |
| mkdir tap && cd tap && git init && git remote add origin "https://x-access-token:${TAP_TOKEN}@github.com/ComputelessComputer/homebrew-aipm.git" | |
| } | |
| mkdir -p tap/Formula | |
| cp Formula/aipm.rb tap/Formula/ | |
| cd tap | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Formula/aipm.rb | |
| git diff --cached --quiet || { | |
| git commit -m "aipm ${{ steps.sha.outputs.version }}" | |
| git branch -M main | |
| git push -u origin main | |
| } |