diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..40b89da --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,46 @@ +name: Build Release +on: + push: + tags: ["*"] + branches: ["*"] + +jobs: + build: + runs-on: ubuntu-latest + env: + CARGO_REGISTRIES_CRATES_IO_PROTOCOL: "sparse" + strategy: + matrix: + target: ["x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl"] + steps: + - uses: actions/checkout@v3 + - uses: Swatinem/rust-cache@v2 + - uses: dtolnay/rust-toolchain@stable + - name: Install cross + run: | + cargo install cross --git https://github.com/cross-rs/cross + + - name: Build project ${{ matrix.target }} + run: | + cross build --release --target ${{ matrix.target }} + + - name: Upload build result + uses: actions/upload-artifact@v4 + with: + path: target/release/${{ matrix.target }}/modrinth-downloader + name: modrinth-downloader-${{ matrix.target }} + + release: + runs-on: ubuntu-latest + needs: build + + permissions: + contents: write + steps: + - name: Download build results + uses: actions/download-artifact@v4 + - uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + modrinth-downloader-* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 1477a75..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Build Release -on: - push: - tags: ["*"] - -jobs: - build: - runs-on: ubuntu-latest - env: - CARGO_REGISTRIES_CRATES_IO_PROTOCOL: "sparse" - permissions: - contents: write - steps: - - uses: actions/checkout@v3 - - uses: Swatinem/rust-cache@v2 - - uses: dtolnay/rust-toolchain@stable - - name: Install cross - run: | - cargo install cross --git https://github.com/cross-rs/cross - - name: Build project x86_64 - run: | - cross build --release --target x86_64-unknown-linux-musl - - name: Build project AARCH64 - run: | - cross build --release --target aarch64-unknown-linux-musl - mv target/aarch64-unknown-linux-musl/release/modrinth-downloader target/aarch64-unknown-linux-musl/release/aarch64-modrinth-downloader - - - uses: softprops/action-gh-release@v1 - with: - files: | - target/x86_64-unknown-linux-musl/release/modrinth-downloader - target/aarch64-unknown-linux-musl/release/aarch64-modrinth-downloader