From 406245f7a421cbd72169f25ec5ac6c7393131fe6 Mon Sep 17 00:00:00 2001 From: shimwell Date: Tue, 22 Oct 2024 23:56:43 +0100 Subject: [PATCH] added publish action --- .github/workflows/crate-publish.yml | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/crate-publish.yml diff --git a/.github/workflows/crate-publish.yml b/.github/workflows/crate-publish.yml new file mode 100644 index 0000000..1a5aeda --- /dev/null +++ b/.github/workflows/crate-publish.yml @@ -0,0 +1,41 @@ +name: Main + +on: + push: + +env: + CARGO_TERM_COLOR: always + +jobs: + build-test: + name: Build and test (${{ matrix.os }}) + + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + - run: rustup update stable && rustup default stable + - run: cargo build --verbose + - run: cargo test --verbose + + publish: + name: Publish to crates.io + if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Publish + # https://doc.rust-lang.org/cargo/reference/config.html?highlight=CARGO_REGISTRY_TOKEN#credentials + - - run: rustup update stable && rustup default stable + - run: > + cargo publish + --dry-run + --verbose + --locked + --token ${{ secrets.CARGO_REGISTRY_TOKEN }}