-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
929ca42
commit 7622ef8
Showing
6 changed files
with
100 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,40 @@ | ||
name: release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
crate: | ||
description: 'Crate to release' | ||
required: true | ||
default: 'blockchain-cli' | ||
workflow_call: | ||
inputs: | ||
crate: | ||
description: 'Crate to release' | ||
required: true | ||
type: string | ||
secrets: | ||
CARGO_REGISTRY_TOKEN: | ||
required: true | ||
|
||
name: Release | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
cargo-publish: | ||
name: Publish and Tag | ||
release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
continue-on-error: true | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: jrobsonchase/[email protected] | ||
- name: Publish | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: publish | ||
args: -p ${{ inputs.crate }} --token ${{secrets.CARGO_REGISTRY_TOKEN}} | ||
- name: Tag | ||
run: | | ||
version="$(extract-crate-version ${{inputs.crate}})" | ||
git config user.name "GitHub Action" | ||
git config user.email [email protected] | ||
git tag -a -m "Version ${version}" ${{inputs.crate}}-v${version} | ||
git push --tags | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Rust | ||
uses: actions/setup-rust@v1 | ||
with: | ||
rust-version: stable | ||
|
||
- name: Install cargo-release | ||
run: cargo install cargo-release | ||
|
||
- name: Bump version and create GitHub release | ||
run: | | ||
# Bump the version and create a GitHub release | ||
cargo release | ||
# Get the version number from Cargo.toml | ||
VERSION=$(grep -oP 'version = "\K[^"]+' Cargo.toml) | ||
# Create a GitHub release using the GitHub CLI | ||
gh release create "v$VERSION" target/package/blockchain-cli-*.crate -t "v$VERSION" | ||
env: | ||
CRATE_NAME: blockchain-cli | ||
|
||
- name: Publish to crates.io | ||
run: cargo publish | ||
env: | ||
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ authors = ["Slavik Pastushenko <[email protected]>"] | |
keywords = ["cli", "crypto", "blockchain"] | ||
exclude = [".prettierrc.toml", ".github/**"] | ||
categories = ["command-line-utilities", "cryptography"] | ||
documentation = "https://docs.rs/blockchain-cli/1.0.0" | ||
documentation = "https://docs.rs/blockchain-cli" | ||
repository = "https://github.com/slavik-pastushenko/blockchain-rust" | ||
|
||
[lib] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters