# SPDX-FileCopyrightText: 2021 Robin Vobruba <hoijui.quaero@gmail.com>
#
# SPDX-License-Identifier: Unlicense
# NOTE We disable this for now, because:
#
# # Putting tiny, crappy, rust newb-projects on crates.io?
# or
# # How to publish tiny, crappy, rust newb-projects?
#
# ... to not pollute the global name-space.
#
# ## Solutions
#
# ### Name
#
# You can just name them "hoijui-shitty-project1" or something.
#
# ### Not on crates.io
#
# ... but personally,
# I wouldn't upload them to crates.io unless I was sure it's something that:
#
# a) I want to commit maintaining
# b) is something other people will find useful.
#
# You can still have your project on your github and have people use it easily, see:
# <https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-dependencies-from-git-repositories>
#
# This also works wih `cargo install`, if it is some command line tool.
#
# The only real restriction is,
# that if other people depend on your github repo,
# they wouldn't then be able to publish their own stuff on crates.io,
# because github dependencies aren't allowed there.
# So you'd probably want to use a license that permits them to fork/copy your code.
name: publish
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
jobs:
push_to_registry:
name: Check and publish
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- name: Get the Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
# Smart caching for rust/cargo projects with sensible defaults.
- uses: Swatinem/rust-cache@v1
# `cargo check` command here will use installed `nightly`
# as it is set as an "override" for current directory
- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features
- name: Publish
uses: katyo/publish-crates@v1
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}