fix ios binary build os to macos-latest and change cross to false #19
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.asset_name }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| binary: zbr | |
| asset_name: zbr | |
| cross: false | |
| - os: ubuntu-latest | |
| target: aarch64-linux-android | |
| binary: zbr | |
| asset_name: zbr-android-arm64 | |
| cross: true | |
| - os: macos-latest | |
| target: aarch64-apple-ios | |
| binary: zbr | |
| asset_name: zbr-ios-arm64 | |
| cross: false | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| binary: zbr | |
| asset_name: zbr-darwin-x64 | |
| cross: false | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| binary: zbr | |
| asset_name: zbr-darwin-arm64 | |
| cross: false | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| binary: zbr.exe | |
| asset_name: zbr.exe | |
| cross: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ matrix.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Install cross | |
| if: matrix.cross == true | |
| run: cargo install cross | |
| - name: Build | |
| shell: bash | |
| run: | | |
| if [ "${{ matrix.cross }}" == "true" ]; then | |
| cross build --release --target ${{ matrix.target }} | |
| else | |
| cargo build --release --target ${{ matrix.target }} | |
| fi | |
| - name: Rename binary | |
| shell: bash | |
| run: | | |
| if [ "${{ matrix.binary }}" != "${{ matrix.asset_name }}" ]; then | |
| mv target/${{ matrix.target }}/release/${{ matrix.binary }} target/${{ matrix.target }}/release/${{ matrix.asset_name }} | |
| fi | |
| - name: Create Release and Upload Asset | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: target/${{ matrix.target }}/release/${{ matrix.asset_name }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish: | |
| name: Publish to npm | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Extract version from tag | |
| id: tag_version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Update package.json version | |
| run: npm pkg set version=${{ steps.tag_version.outputs.VERSION }} | |
| - name: Publish to npm | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |