Skip to content

Commit 29a7ae8

Browse files
authored
Merge pull request #672 from axone-protocol/ci/publish
Ci/publish
2 parents 4362985 + 5986bc9 commit 29a7ae8

File tree

17 files changed

+278
-100
lines changed

17 files changed

+278
-100
lines changed

.editorconfig

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ charset = utf-8
1212
trim_trailing_whitespace = false
1313
indent_size = 2
1414

15+
[*.cjs]
16+
trim_trailing_whitespace = false
17+
indent_size = 2
18+
1519
[*.{yml,yaml,json}]
1620
trim_trailing_whitespace = false
1721
indent_size = 2

.github/workflows/publish.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ["v*"]
7+
8+
concurrency:
9+
group: publish-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
publish-crates:
14+
runs-on: ubuntu-22.04
15+
steps:
16+
- name: Check out repository
17+
uses: actions/checkout@v4
18+
19+
- name: Cache cargo registry
20+
uses: actions/cache@v4
21+
with:
22+
path: |
23+
~/.cargo/registry
24+
~/.cargo/git
25+
~/.cargo/bin
26+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
27+
restore-keys: |
28+
${{ runner.os }}-cargo-
29+
30+
- name: Setup rust
31+
uses: actions-rs/toolchain@v1
32+
with:
33+
toolchain: 1.75
34+
default: true
35+
override: true
36+
37+
- name: Install cargo make
38+
uses: davidB/rust-cargo-make@v1
39+
40+
- name: Publish crates to crates.io
41+
env:
42+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
43+
run: |
44+
cargo make publish-crates

.releaserc.cjs

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
module.exports = {
2+
branches: ["main"],
3+
plugins: [
4+
[
5+
"@semantic-release/commit-analyzer",
6+
{
7+
preset: "conventionalcommits",
8+
releaseRules: [
9+
{ type: "build", scope: "deps", release: "patch" },
10+
{ type: "build", scope: "deps-dev", release: "patch" },
11+
{ type: "refactor", release: "patch" },
12+
{ type: "style", release: "patch" },
13+
{ type: "ci", release: "patch" },
14+
{ type: "chore", release: "patch" },
15+
{ type: "docs", release: "patch" },
16+
{ breaking: true, release: "major" },
17+
],
18+
},
19+
],
20+
[
21+
"@semantic-release/release-notes-generator",
22+
{
23+
preset: "conventionalcommits",
24+
},
25+
],
26+
[
27+
"@semantic-release/changelog",
28+
{
29+
changelogFile: "CHANGELOG.md",
30+
changelogTitle: "# AXONE contracts",
31+
},
32+
],
33+
[
34+
"semantic-release-replace-plugin",
35+
{
36+
replacements: [
37+
{
38+
files: ["Cargo.toml"],
39+
from: /^version\s+=\s+"\d+\.\d+\.\d+"$/gm,
40+
to: 'version = "${nextRelease.version}"',
41+
countMatches: true,
42+
results: [
43+
{
44+
file: "Cargo.toml",
45+
hasChanged: true,
46+
numMatches: 1,
47+
numReplacements: 1,
48+
},
49+
],
50+
},
51+
{
52+
files: ["Cargo.toml"],
53+
from: /((axone-[\w-]+)\s*=\s*\{\s*path\s*=\s*"\.\/[^"]*",\s+version\s+=\s+)"\d+\.\d+\.\d+"/g,
54+
to: (
55+
_match,
56+
prefix,
57+
_dependencyName,
58+
_path,
59+
_extra,
60+
_version,
61+
context
62+
) => `${prefix}"${context.nextRelease.version}"`,
63+
countMatches: true,
64+
results: [
65+
{
66+
file: "Cargo.toml",
67+
hasChanged: true,
68+
numMatches: 7,
69+
numReplacements: 7,
70+
},
71+
],
72+
},
73+
],
74+
},
75+
],
76+
[
77+
"@semantic-release/exec",
78+
{
79+
prepareCmd:
80+
"cargo make schema && cargo make docs-generate && cargo make release-wasm",
81+
},
82+
],
83+
[
84+
"@semantic-release/github",
85+
{
86+
successComment: false,
87+
assets: [
88+
{ path: "./artifacts/axone_objectarium.wasm" },
89+
{ path: "./artifacts/axone_law_stone.wasm" },
90+
{ path: "./artifacts/axone_cognitarium.wasm" },
91+
{ path: "./artifacts/axone_dataverse.wasm" },
92+
{ path: "./artifacts/checksums.txt" },
93+
{
94+
path: "./contracts/axone-objectarium/schema/axone-objectarium.json",
95+
},
96+
{ path: "./contracts/axone-law-stone/schema/axone-law-stone.json" },
97+
{
98+
path: "./contracts/axone-cognitarium/schema/axone-cognitarium.json",
99+
},
100+
{ path: "./contracts/axone-dataverse/schema/axone-dataverse.json" },
101+
],
102+
},
103+
],
104+
[
105+
"@semantic-release/git",
106+
{
107+
assets: [
108+
"CHANGELOG.md",
109+
"contracts/*/Cargo.toml",
110+
"packages/*/Cargo.toml",
111+
"docs/**",
112+
"Cargo.lock",
113+
],
114+
message: "chore(release): perform release ${nextRelease.version}",
115+
},
116+
],
117+
],
118+
};

.releaserc.yml

-60
This file was deleted.

Cargo.toml

+16-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
members = ["contracts/*", "packages/*"]
33
resolver = "2"
44

5+
[workspace.package]
6+
authors = ["AXONE"]
7+
edition = "2021"
8+
homepage = "https://axone.xyz/"
9+
license-file = "LICENSE"
10+
repository = "https://github.com/axone-protocol/contracts"
11+
rust-version = "1.75"
12+
version = "6.0.0"
13+
514
[profile.release]
615
codegen-units = 1
716
debug = false
@@ -14,17 +23,17 @@ panic = 'abort'
1423
rpath = false
1524

1625
[workspace.dependencies]
17-
axone-cognitarium = { path = "contracts/axone-cognitarium", features = [
26+
axone-cognitarium = { path = "./contracts/axone-cognitarium", version = "6.0.0", features = [
1827
"library",
1928
] }
20-
axone-cognitarium-client = { path = "packages/axone-cognitarium-client" }
21-
axone-logic-bindings = { path = "packages/axone-logic-bindings" }
22-
axone-objectarium = { path = "contracts/axone-objectarium", features = [
29+
axone-cognitarium-client = { path = "./packages/axone-cognitarium-client", version = "6.0.0" }
30+
axone-logic-bindings = { path = "./packages/axone-logic-bindings", version = "6.0.0" }
31+
axone-objectarium = { path = "./contracts/axone-objectarium", version = "6.0.0", features = [
2332
"library",
2433
] }
25-
axone-objectarium-client = { path = "packages/axone-objectarium-client" }
26-
axone-rdf = { path = "packages/axone-rdf" }
27-
axone-wasm = { path = "packages/axone-wasm" }
34+
axone-objectarium-client = { path = "./packages/axone-objectarium-client", version = "6.0.0" }
35+
axone-rdf = { path = "./packages/axone-rdf", version = "6.0.0" }
36+
axone-wasm = { path = "./packages/axone-wasm", version = "6.0.0" }
2837
cosmwasm-schema = "2.1.5"
2938
cosmwasm-std = { version = "2.1.5", features = ["cosmwasm_2_1"] }
3039
cosmwasm-storage = "1.5.2"

Makefile.toml

+20
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,12 @@ install_crate_args = ["--force"]
627627
[tasks.install-cosmwasm-check]
628628
install_crate = { crate_name = "cosmwasm-check", min_version = "2.1.1" }
629629

630+
[tasks.install-cargo-workspaces]
631+
install_crate = { crate_name = "cargo-workspaces", binary = "cargo", test_arg = [
632+
"workspaces",
633+
"--help",
634+
], min_version = "0.3.6" }
635+
630636
[tasks.install-ffizer]
631637
install_script = '''
632638
if ! [ -x "$(command -v ffizer)" ]; then
@@ -638,6 +644,20 @@ fi
638644
[tasks.install-cargo-hack]
639645
install_crate = { crate_name = "cargo-hack", min_version = "0.6.14" }
640646

647+
[tasks.publish-crates]
648+
args = [
649+
"workspaces",
650+
"publish",
651+
"--from-git",
652+
"--yes",
653+
"--no-git-commit",
654+
"skip",
655+
]
656+
command = "cargo"
657+
condition = { env_set = ["CARGO_REGISTRY_TOKEN"] }
658+
dependencies = ["install-cargo-workspaces"]
659+
description = "Publish all crates to the registry. Requires CARGO_REGISTRY_TOKEN to be set."
660+
641661
[config]
642662
default_to_workspace = false
643663
min_version = "0.36.3"

contracts/axone-cognitarium/Cargo.toml

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
[package]
2-
authors = ["AXONE"]
3-
edition = "2021"
2+
authors = { workspace = true }
3+
description = "A CosmWasm Smart Contract which enables the storage and querying of Semantic data using RDF, which represents information as semantic triples."
4+
edition = { workspace = true }
5+
homepage = { workspace = true }
6+
license-file = { workspace = true }
47
name = "axone-cognitarium"
5-
rust-version = "1.75"
6-
version = "6.0.0"
8+
repository = { workspace = true }
9+
rust-version = { workspace = true }
10+
version = { workspace = true }
711

812
exclude = [
913
# 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.

contracts/axone-dataverse/Cargo.toml

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
[package]
2-
authors = ["AXONE"]
3-
edition = "2021"
2+
authors = { workspace = true }
3+
description = "The Smart Contract overseeing and managing the Dataverse in the AXONE ecosystem."
4+
edition = { workspace = true }
5+
homepage = { workspace = true }
6+
license-file = { workspace = true }
47
name = "axone-dataverse"
5-
rust-version = "1.75"
6-
version = "6.0.0"
8+
repository = { workspace = true }
9+
rust-version = { workspace = true }
10+
version = { workspace = true }
711

812
exclude = [
913
# 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.

contracts/axone-law-stone/Cargo.toml

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
[package]
2-
authors = ["AXONE"]
3-
edition = "2021"
2+
authors = { workspace = true }
3+
description = "The Smart Contract providing Governance as a Service."
4+
edition = { workspace = true }
5+
homepage = { workspace = true }
6+
license-file = { workspace = true }
47
name = "axone-law-stone"
5-
rust-version = "1.75"
6-
version = "6.0.0"
8+
repository = { workspace = true }
9+
rust-version = { workspace = true }
10+
version = { workspace = true }
711

812
exclude = [
913
# 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.

contracts/axone-objectarium/Cargo.toml

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
[package]
2-
authors = ["AXONE"]
3-
edition = "2021"
2+
authors = { workspace = true }
3+
description = "A Smart Contract which enables the storage of arbitrary unstructured Objects."
4+
edition = { workspace = true }
5+
homepage = { workspace = true }
6+
license-file = { workspace = true }
47
name = "axone-objectarium"
5-
rust-version = "1.75"
6-
version = "6.0.0"
8+
repository = { workspace = true }
9+
rust-version = { workspace = true }
10+
version = { workspace = true }
711

812
exclude = [
913
# 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.

packages/axone-cognitarium-client/Cargo.toml

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
[package]
2-
authors = ["AXONE"]
3-
edition = "2021"
2+
authors = { workspace = true }
3+
edition = { workspace = true }
44
name = "axone-cognitarium-client"
5-
version = "6.0.0"
5+
6+
description = "A client library for the Axone Cognitarium Smart Contract."
7+
homepage = { workspace = true }
8+
license-file = { workspace = true }
9+
repository = { workspace = true }
10+
version = { workspace = true }
611

712
[dependencies]
813
axone-cognitarium.workspace = true

0 commit comments

Comments
 (0)