Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Github Action to automatically publish crate to crate.io #211

Merged
merged 10 commits into from
Sep 7, 2021
29 changes: 29 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
create:
tags:
- v*

name: Publish Crate

jobs:
publish:
name: Deploy a new version of Rspotify to crate.io
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Release
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
shell: bash
run: |
# Publishing crates
"${GITHUB_WORKSPACE}/tools/publish.sh"
17 changes: 17 additions & 0 deletions tools/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# If crate A depends on crate B, B must come before A in this list
crates=(
rspotify-macros
rspotify-model
rspotify-http
)

for crate in "${crates[@]}"; do
echo "Publishing ${crate}"
(
cd "$crate"
cargo publish --no-verify
)
sleep 20
done

cargo publish