Skip to content

Commit

Permalink
Merge pull request #672 from axone-protocol/ci/publish
Browse files Browse the repository at this point in the history
Ci/publish
  • Loading branch information
ccamel authored Dec 13, 2024
2 parents 4362985 + 5986bc9 commit 29a7ae8
Show file tree
Hide file tree
Showing 17 changed files with 278 additions and 100 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ charset = utf-8
trim_trailing_whitespace = false
indent_size = 2

[*.cjs]
trim_trailing_whitespace = false
indent_size = 2

[*.{yml,yaml,json}]
trim_trailing_whitespace = false
indent_size = 2
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish

on:
push:
branches: [main]
tags: ["v*"]

concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: true

jobs:
publish-crates:
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.75
default: true
override: true

- name: Install cargo make
uses: davidB/rust-cargo-make@v1

- name: Publish crates to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo make publish-crates
118 changes: 118 additions & 0 deletions .releaserc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
module.exports = {
branches: ["main"],
plugins: [
[
"@semantic-release/commit-analyzer",
{
preset: "conventionalcommits",
releaseRules: [
{ type: "build", scope: "deps", release: "patch" },
{ type: "build", scope: "deps-dev", release: "patch" },
{ type: "refactor", release: "patch" },
{ type: "style", release: "patch" },
{ type: "ci", release: "patch" },
{ type: "chore", release: "patch" },
{ type: "docs", release: "patch" },
{ breaking: true, release: "major" },
],
},
],
[
"@semantic-release/release-notes-generator",
{
preset: "conventionalcommits",
},
],
[
"@semantic-release/changelog",
{
changelogFile: "CHANGELOG.md",
changelogTitle: "# AXONE contracts",
},
],
[
"semantic-release-replace-plugin",
{
replacements: [
{
files: ["Cargo.toml"],
from: /^version\s+=\s+"\d+\.\d+\.\d+"$/gm,
to: 'version = "${nextRelease.version}"',
countMatches: true,
results: [
{
file: "Cargo.toml",
hasChanged: true,
numMatches: 1,
numReplacements: 1,
},
],
},
{
files: ["Cargo.toml"],
from: /((axone-[\w-]+)\s*=\s*\{\s*path\s*=\s*"\.\/[^"]*",\s+version\s+=\s+)"\d+\.\d+\.\d+"/g,
to: (
_match,
prefix,
_dependencyName,
_path,
_extra,
_version,
context
) => `${prefix}"${context.nextRelease.version}"`,
countMatches: true,
results: [
{
file: "Cargo.toml",
hasChanged: true,
numMatches: 7,
numReplacements: 7,
},
],
},
],
},
],
[
"@semantic-release/exec",
{
prepareCmd:
"cargo make schema && cargo make docs-generate && cargo make release-wasm",
},
],
[
"@semantic-release/github",
{
successComment: false,
assets: [
{ path: "./artifacts/axone_objectarium.wasm" },
{ path: "./artifacts/axone_law_stone.wasm" },
{ path: "./artifacts/axone_cognitarium.wasm" },
{ path: "./artifacts/axone_dataverse.wasm" },
{ path: "./artifacts/checksums.txt" },
{
path: "./contracts/axone-objectarium/schema/axone-objectarium.json",
},
{ path: "./contracts/axone-law-stone/schema/axone-law-stone.json" },
{
path: "./contracts/axone-cognitarium/schema/axone-cognitarium.json",
},
{ path: "./contracts/axone-dataverse/schema/axone-dataverse.json" },
],
},
],
[
"@semantic-release/git",
{
assets: [
"CHANGELOG.md",
"contracts/*/Cargo.toml",
"packages/*/Cargo.toml",
"docs/**",
"Cargo.lock",
],
message: "chore(release): perform release ${nextRelease.version}",
},
],
],
};
60 changes: 0 additions & 60 deletions .releaserc.yml

This file was deleted.

23 changes: 16 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
members = ["contracts/*", "packages/*"]
resolver = "2"

[workspace.package]
authors = ["AXONE"]
edition = "2021"
homepage = "https://axone.xyz/"
license-file = "LICENSE"
repository = "https://github.com/axone-protocol/contracts"
rust-version = "1.75"
version = "6.0.0"

[profile.release]
codegen-units = 1
debug = false
Expand All @@ -14,17 +23,17 @@ panic = 'abort'
rpath = false

[workspace.dependencies]
axone-cognitarium = { path = "contracts/axone-cognitarium", features = [
axone-cognitarium = { path = "./contracts/axone-cognitarium", version = "6.0.0", features = [
"library",
] }
axone-cognitarium-client = { path = "packages/axone-cognitarium-client" }
axone-logic-bindings = { path = "packages/axone-logic-bindings" }
axone-objectarium = { path = "contracts/axone-objectarium", features = [
axone-cognitarium-client = { path = "./packages/axone-cognitarium-client", version = "6.0.0" }
axone-logic-bindings = { path = "./packages/axone-logic-bindings", version = "6.0.0" }
axone-objectarium = { path = "./contracts/axone-objectarium", version = "6.0.0", features = [
"library",
] }
axone-objectarium-client = { path = "packages/axone-objectarium-client" }
axone-rdf = { path = "packages/axone-rdf" }
axone-wasm = { path = "packages/axone-wasm" }
axone-objectarium-client = { path = "./packages/axone-objectarium-client", version = "6.0.0" }
axone-rdf = { path = "./packages/axone-rdf", version = "6.0.0" }
axone-wasm = { path = "./packages/axone-wasm", version = "6.0.0" }
cosmwasm-schema = "2.1.5"
cosmwasm-std = { version = "2.1.5", features = ["cosmwasm_2_1"] }
cosmwasm-storage = "1.5.2"
Expand Down
20 changes: 20 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,12 @@ install_crate_args = ["--force"]
[tasks.install-cosmwasm-check]
install_crate = { crate_name = "cosmwasm-check", min_version = "2.1.1" }

[tasks.install-cargo-workspaces]
install_crate = { crate_name = "cargo-workspaces", binary = "cargo", test_arg = [
"workspaces",
"--help",
], min_version = "0.3.6" }

[tasks.install-ffizer]
install_script = '''
if ! [ -x "$(command -v ffizer)" ]; then
Expand All @@ -638,6 +644,20 @@ fi
[tasks.install-cargo-hack]
install_crate = { crate_name = "cargo-hack", min_version = "0.6.14" }

[tasks.publish-crates]
args = [
"workspaces",
"publish",
"--from-git",
"--yes",
"--no-git-commit",
"skip",
]
command = "cargo"
condition = { env_set = ["CARGO_REGISTRY_TOKEN"] }
dependencies = ["install-cargo-workspaces"]
description = "Publish all crates to the registry. Requires CARGO_REGISTRY_TOKEN to be set."

[config]
default_to_workspace = false
min_version = "0.36.3"
Expand Down
12 changes: 8 additions & 4 deletions contracts/axone-cognitarium/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
[package]
authors = ["AXONE"]
edition = "2021"
authors = { workspace = true }
description = "A CosmWasm Smart Contract which enables the storage and querying of Semantic data using RDF, which represents information as semantic triples."
edition = { workspace = true }
homepage = { workspace = true }
license-file = { workspace = true }
name = "axone-cognitarium"
rust-version = "1.75"
version = "6.0.0"
repository = { workspace = true }
rust-version = { workspace = true }
version = { workspace = true }

exclude = [
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication.
Expand Down
12 changes: 8 additions & 4 deletions contracts/axone-dataverse/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
[package]
authors = ["AXONE"]
edition = "2021"
authors = { workspace = true }
description = "The Smart Contract overseeing and managing the Dataverse in the AXONE ecosystem."
edition = { workspace = true }
homepage = { workspace = true }
license-file = { workspace = true }
name = "axone-dataverse"
rust-version = "1.75"
version = "6.0.0"
repository = { workspace = true }
rust-version = { workspace = true }
version = { workspace = true }

exclude = [
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication.
Expand Down
12 changes: 8 additions & 4 deletions contracts/axone-law-stone/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
[package]
authors = ["AXONE"]
edition = "2021"
authors = { workspace = true }
description = "The Smart Contract providing Governance as a Service."
edition = { workspace = true }
homepage = { workspace = true }
license-file = { workspace = true }
name = "axone-law-stone"
rust-version = "1.75"
version = "6.0.0"
repository = { workspace = true }
rust-version = { workspace = true }
version = { workspace = true }

exclude = [
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication.
Expand Down
12 changes: 8 additions & 4 deletions contracts/axone-objectarium/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
[package]
authors = ["AXONE"]
edition = "2021"
authors = { workspace = true }
description = "A Smart Contract which enables the storage of arbitrary unstructured Objects."
edition = { workspace = true }
homepage = { workspace = true }
license-file = { workspace = true }
name = "axone-objectarium"
rust-version = "1.75"
version = "6.0.0"
repository = { workspace = true }
rust-version = { workspace = true }
version = { workspace = true }

exclude = [
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication.
Expand Down
11 changes: 8 additions & 3 deletions packages/axone-cognitarium-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
[package]
authors = ["AXONE"]
edition = "2021"
authors = { workspace = true }
edition = { workspace = true }
name = "axone-cognitarium-client"
version = "6.0.0"

description = "A client library for the Axone Cognitarium Smart Contract."
homepage = { workspace = true }
license-file = { workspace = true }
repository = { workspace = true }
version = { workspace = true }

[dependencies]
axone-cognitarium.workspace = true
Expand Down
Loading

0 comments on commit 29a7ae8

Please sign in to comment.