Skip to content

Commit

Permalink
Merge branch 'chore/publish-crate'
Browse files Browse the repository at this point in the history
  • Loading branch information
ilbertt committed Oct 17, 2023
2 parents ec6d2fc + beeb684 commit 716e248
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Release ic-websocket-cdk-rs

# only run when the tests complete
on:
workflow_run:
workflows: [ic-websocket-cdk-rs tests]
types:
- completed
branches:
- main

jobs:
publish:
runs-on: ubuntu-latest
# only run if the tests were successful
if: ${{ github.event.workflow_run.conclusion == 'success' }}
outputs:
exit_code: ${{ steps.npm-publish.outputs.exit_code }}
version: ${{ steps.npm-publish.outputs.version }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.69.0
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
- run: |
cargo publish -p ic-websocket-cdk
EXIT_CODE=$?
echo "exit_code=$EXIT_CODE" >> "$GITHUB_OUTPUT"
echo "version=v$(cargo pkgid -p ic-websocket-cdk | cut -d# -f2 | cut -d: -f2)" >> "$GITHUB_OUTPUT"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
tag:
needs: publish
runs-on: ubuntu-latest
if: ${{ needs.publish.outputs.exit_code == "0" }}
outputs:
version: ${{ steps.tag_version.outputs.new_tag }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ needs.publish.outputs.version }}

release:
needs: tag
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.tag.outputs.version }}
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ members = [
edition = "2021"
repository = "https://github.com/omnia-network/ic-websocket-cdk-rs"
rust-version = "1.69.0"
description = "IC Websocket Canister Development Kit"

[workspace.dependencies]
ic-websocket-cdk = { path = "src/ic-websocket-cdk", version = "0.1.0" }
Expand Down
4 changes: 4 additions & 0 deletions src/ic-websocket-cdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ version = "0.1.0"
edition.workspace = true
rust-version.workspace = true
repository.workspace = true
description.workspace = true
exclude = [
"**/*.did",
]

[dependencies]
candid = { workspace = true }
Expand Down

0 comments on commit 716e248

Please sign in to comment.