Skip to content

Commit

Permalink
feat(ci) add ci to publish to crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
uhryniuk committed Oct 13, 2024
1 parent 0fcc25e commit 5700aeb
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 2 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/cargo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
on:
push:
tags:
- '*'
workflow_dispatch:

name: Publish

jobs:
audit:
name: Audit
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: rustsec/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}

build_and_test_linux:
name: Build and Test (Linux)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- uses: taiki-e/install-action@nextest
- name: 'Build and test'
run: cargo nextest run --workspace --all-targets --all-features


build_and_test_macos:
name: Build and Test (MacOS)
runs-on: macos-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- uses: taiki-e/install-action@nextest
- name: 'Build and test'
run: cargo nextest run --workspace --all-targets --all-features

crates_io_publish:
name: Publish (crates.io)
needs:
- audit
- build_and_test_linux
- build_and_test_macos

runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- name: cargo-release Cache
id: cargo_release_cache
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-release
key: ${{ runner.os }}-cargo-release

- run: cargo install cargo-release
if: steps.cargo_release_cache.outputs.cache-hit != 'true'

- name: cargo login
run: cargo login ${{ secrets.CARGO_API_TOKEN }}

- name: "cargo release publish"
run: |-
cargo release \
publish \
--workspace \
--all-features \
--allow-branch HEAD \
--no-confirm \
--execute
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: auto-release

on:
schedule:
- cron: '0 0 */14 * *' # Runs every 14 days at midnight UTC
# schedule:
# - cron: '0 0 */14 * *' # Runs every 14 days at midnight UTC
workflow_dispatch:

jobs:
Expand Down

0 comments on commit 5700aeb

Please sign in to comment.