diff --git a/.github/workflows/maturin_upload_pypi.yml b/.github/workflows/maturin_upload_pypi.yml index b8d6825..ced3f0a 100644 --- a/.github/workflows/maturin_upload_pypi.yml +++ b/.github/workflows/maturin_upload_pypi.yml @@ -7,11 +7,6 @@ name: Upload to PyPI on: push: - branches: - - main - - master - tags: - - '*' pull_request: workflow_dispatch: @@ -34,7 +29,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - args: --release --out dist --find-interpreter + args: --release --out ../dist --find-interpreter sccache: 'true' manylinux: auto working-directory: lib/ @@ -43,6 +38,7 @@ jobs: with: name: wheels path: dist + if-no-files-found: error windows: runs-on: windows-latest @@ -60,7 +56,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - args: --release --out dist --find-interpreter + args: --release --out ../dist --find-interpreter sccache: 'true' working-directory: lib/ - name: Upload wheels @@ -68,6 +64,7 @@ jobs: with: name: wheels path: dist + if-no-files-found: error macos: runs-on: macos-latest @@ -84,7 +81,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - args: --release --out dist --find-interpreter + args: --release --out ../dist --find-interpreter sccache: 'true' working-directory: lib/ - name: Upload wheels @@ -92,24 +89,29 @@ jobs: with: name: wheels path: dist + if-no-files-found: error sdist: runs-on: ubuntu-latest strategy: fail-fast: false steps: - - uses: actions/checkout@v3 + - name: Checkout repo + uses: actions/checkout@v4 + - name: Build sdist uses: PyO3/maturin-action@v1 with: command: sdist - args: --out dist + args: --out ../dist working-directory: lib/ + - name: Upload sdist uses: actions/upload-artifact@v3 with: name: wheels path: dist + if-no-files-found: error release: name: Release diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b9c480f..63c0b89 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,10 @@ +name: Rust crate and cli release + on: - release: - types: [created] + push: + pull_request: + workflow_dispatch: + jobs: release: name: release ${{ matrix.target }} @@ -8,35 +12,61 @@ jobs: strategy: fail-fast: false matrix: - include: + include: # https://github.com/rust-build/rust-build.action#supported-targets - target: x86_64-pc-windows-gnu archive: zip - - target: x86_64-pc-windows-msvc - archive: zip - target: x86_64-apple-darwin archive: zip - target: x86_64-unknown-linux-musl archive: tar.gz - - target: x86_64-unknown-linux-gnu - archive: tar.gz + steps: - - uses: actions/checkout@master - - name: Compile and release + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Compile cli for artifact + id: compile_cli uses: rust-build/rust-build.action@v1.4.4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: RUSTTARGET: ${{ matrix.target }} ARCHIVE_TYPES: ${{ matrix.archive }} + SRC_DIR: cli/ + UPLOAD_MODE: none + + - name: Upload cli artifact + uses: actions/upload-artifact@v3 + with: + name: crunch64-cli-${{ matrix.target }} + path: | + ${{ steps.compile_cli.outputs.BUILT_ARCHIVE }} + ${{ steps.compile_cli.outputs.BUILT_CHECKSUM }} + - name: Compile and release cli + uses: rust-build/rust-build.action@v1.4.4 + if: "startsWith(github.ref, 'refs/tags/')" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + RUSTTARGET: ${{ matrix.target }} + ARCHIVE_TYPES: ${{ matrix.archive }} + SRC_DIR: cli/ + UPLOAD_MODE: release publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Rust toolchain + uses: actions-rs/toolchain@v1 with: - toolchain: stable - override: true - - uses: katyo/publish-crates@v2 + toolchain: stable + override: true + + - name: Publish crate + uses: katyo/publish-crates@v2 + if: "startsWith(github.ref, 'refs/tags/')" with: - registry-token: ${{ secrets.CRATE_AUTH_TOKEN }} + registry-token: ${{ secrets.CRATE_AUTH_TOKEN }}