From a59d4138a81add31868b8549f39d77c36ba11e98 Mon Sep 17 00:00:00 2001 From: Bohdan Sokolovskyi Date: Thu, 24 Jul 2025 13:40:07 +0300 Subject: [PATCH 1/5] add workflow for release --- .github/workflows/release.yml | 79 +++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9742c05 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,79 @@ +name: Release + +on: + push: + tags: + - 'v*' + +env: + CARGO_TERM_COLOR: always + +jobs: + create-release: + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + build-and-upload: + needs: create-release + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + artifact_name: anki-mtool + asset_name: anki-mtool-linux-x86_64 + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + artifact_name: anki-mtool + asset_name: anki-mtool-linux-x86_64-musl + - os: macos-latest + target: x86_64-apple-darwin + artifact_name: anki-mtool + asset_name: anki-mtool-macos-x86_64 + - os: macos-latest + target: aarch64-apple-darwin + artifact_name: anki-mtool + asset_name: anki-mtool-macos-aarch64 + + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.target }} + override: true + + - name: Install musl-tools (Linux musl only) + if: matrix.target == 'x86_64-unknown-linux-musl' + run: sudo apt-get install -y musl-tools + + - name: Build + uses: actions-rs/cargo@v1 + with: + command: build + args: --release --target ${{ matrix.target }} --bin anki-mtool + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: ./target/${{ matrix.target }}/release/${{ matrix.artifact_name }} + asset_name: ${{ matrix.asset_name }} + asset_content_type: application/octet-stream From e0b658a69a59979e9dc831eb86dbdea36d4e6989 Mon Sep 17 00:00:00 2001 From: Bohdan Sokolovskyi Date: Thu, 24 Jul 2025 17:24:59 +0300 Subject: [PATCH 2/5] add OpenSSL installation --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ec03c78..0f10ae8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,6 +60,9 @@ jobs: toolchain: stable target: ${{ matrix.target }} override: true + - name: Install OpenSSL (Linux musl only) + if: matrix.target == 'x86_64-unknown-linux-musl' + run: sudo apt-get install -y libssl-dev:amd64 - name: Install musl-tools (Linux musl only) if: matrix.target == 'x86_64-unknown-linux-musl' From 6a57acbceccadf85642aaebe807a9af091cb39f0 Mon Sep 17 00:00:00 2001 From: Bohdan Sokolovskyi Date: Thu, 24 Jul 2025 17:35:38 +0300 Subject: [PATCH 3/5] update supported OS for release workflow --- .github/workflows/release.yml | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0f10ae8..9c23cbb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,18 +34,14 @@ jobs: strategy: matrix: include: - - os: ubuntu-latest - target: x86_64-unknown-linux-gnu - artifact_name: anki-mtool - asset_name: anki-mtool-linux-x86_64 - - os: ubuntu-latest - target: x86_64-unknown-linux-musl - artifact_name: anki-mtool - asset_name: anki-mtool-linux-x86_64-musl - - os: macos-latest - target: x86_64-apple-darwin - artifact_name: anki-mtool - asset_name: anki-mtool-macos-x86_64 + # - os: ubuntu-latest + # target: x86_64-unknown-linux-gnu + # artifact_name: anki-mtool + # asset_name: anki-mtool-linux-x86_64 + # - os: ubuntu-latest + # target: x86_64-unknown-linux-musl + # artifact_name: anki-mtool + # asset_name: anki-mtool-linux-x86_64-musl - os: macos-latest target: aarch64-apple-darwin artifact_name: anki-mtool @@ -60,13 +56,13 @@ jobs: toolchain: stable target: ${{ matrix.target }} override: true - - name: Install OpenSSL (Linux musl only) - if: matrix.target == 'x86_64-unknown-linux-musl' - run: sudo apt-get install -y libssl-dev:amd64 + # - name: Install OpenSSL (Linux musl only) + # if: matrix.target == 'x86_64-unknown-linux-musl' + # run: sudo apt-get install -y libssl-dev:amd64 - - name: Install musl-tools (Linux musl only) - if: matrix.target == 'x86_64-unknown-linux-musl' - run: sudo apt-get install -y musl-tools + # - name: Install musl-tools (Linux musl only) + # if: matrix.target == 'x86_64-unknown-linux-musl' + # run: sudo apt-get install -y musl-tools - name: Build uses: actions-rs/cargo@v1 From 9c58dc10b58add44debc99196633b6eeff655c44 Mon Sep 17 00:00:00 2001 From: Bohdan Sokolovskyi Date: Thu, 24 Jul 2025 17:45:57 +0300 Subject: [PATCH 4/5] Update release.yml --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9c23cbb..008e041 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,10 +34,10 @@ jobs: strategy: matrix: include: - # - os: ubuntu-latest - # target: x86_64-unknown-linux-gnu - # artifact_name: anki-mtool - # asset_name: anki-mtool-linux-x86_64 + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + artifact_name: anki-mtool + asset_name: anki-mtool-linux-x86_64 # - os: ubuntu-latest # target: x86_64-unknown-linux-musl # artifact_name: anki-mtool From 5233af0e3617060efdc4a74e054c83751bfd9bb6 Mon Sep 17 00:00:00 2001 From: Bohdan Sokolovskyi Date: Thu, 24 Jul 2025 17:53:01 +0300 Subject: [PATCH 5/5] remove unused OS --- .github/workflows/release.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 008e041..fa588da 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,10 +38,6 @@ jobs: target: x86_64-unknown-linux-gnu artifact_name: anki-mtool asset_name: anki-mtool-linux-x86_64 - # - os: ubuntu-latest - # target: x86_64-unknown-linux-musl - # artifact_name: anki-mtool - # asset_name: anki-mtool-linux-x86_64-musl - os: macos-latest target: aarch64-apple-darwin artifact_name: anki-mtool @@ -56,13 +52,6 @@ jobs: toolchain: stable target: ${{ matrix.target }} override: true - # - name: Install OpenSSL (Linux musl only) - # if: matrix.target == 'x86_64-unknown-linux-musl' - # run: sudo apt-get install -y libssl-dev:amd64 - - # - name: Install musl-tools (Linux musl only) - # if: matrix.target == 'x86_64-unknown-linux-musl' - # run: sudo apt-get install -y musl-tools - name: Build uses: actions-rs/cargo@v1