Skip to content

Commit fad0e97

Browse files
Add GitHub actions for publishing crates. (#147)
* Add GitHub actions for publishing crates. This commit adds a GitHub action (based on a similar one from Wasmtime) for publishing the crates when new tags are created. This also bumps the crate versions to 0.2.0, which will be the first versions of the crates published. * Add the `wit` tool to publishing. The `wit` tool will also start at version 0.1.0. * Add README to packages. * Update .github/workflows/publish-to-crates-io.yml Co-authored-by: Brian <[email protected]> --------- Co-authored-by: Brian <[email protected]>
1 parent 0910c9e commit fad0e97

File tree

8 files changed

+457
-38
lines changed

8 files changed

+457
-38
lines changed
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# The purpose of this workflow is to publish the workspace's crates
2+
# whenever a tag is created. This basically boils down to running
3+
# `scripts/publish.rs` at the right time.
4+
5+
name: "Publish to crates.io"
6+
7+
on:
8+
push:
9+
tags:
10+
- 'v*'
11+
12+
jobs:
13+
publish:
14+
if: github.repository == 'bytecodealliance/cargo-component'
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- run: rustup update stable && rustup default stable
19+
- run: |
20+
rustc ci/publish.rs
21+
./publish publish
22+
env:
23+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

Cargo.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ edition = { workspace = true }
66
authors = { workspace = true }
77
license = { workspace = true }
88
repository = { workspace = true }
9+
readme = "README.md"
910

1011
[workspace.package]
11-
version = "0.1.0"
12+
version = "0.2.0"
1213
edition = "2021"
1314
authors = ["Peter Huene <[email protected]>"]
1415
license = "Apache-2.0 WITH LLVM-exception"
@@ -59,8 +60,8 @@ members = ["crates/bindings", "crates/macro", "crates/core", "crates/wit"]
5960
exclude = ["target/tests"]
6061

6162
[workspace.dependencies]
62-
cargo-component-core = { path = "crates/core", version = "0.1.0" }
63-
cargo-component-macro = { path = "crates/macro", version = "0.1.0" }
63+
cargo-component-core = { path = "crates/core", version = "0.2.0" }
64+
cargo-component-macro = { path = "crates/macro", version = "0.2.0" }
6465
warg-protocol = "0.1.0"
6566
warg-crypto = "0.1.0"
6667
warg-client = "0.1.0"

README.md

+7-16
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,9 @@ may cause build errors for existing component projects.
3838
To install the `cargo component` subcommand, run the following command:
3939

4040
```
41-
cargo install --git https://github.com/bytecodealliance/cargo-component --locked cargo-component
41+
cargo install cargo-component
4242
```
4343

44-
The [currently published crate](https://crates.io/crates/cargo-component)
45-
on crates.io is a nonfunctional placeholder and these instructions will be
46-
updated to install the crates.io package once a proper release is made.
47-
4844
## Motivation
4945

5046
Today, developers that target WebAssembly typically compile a monolithic
@@ -295,9 +291,8 @@ for other IDEs.
295291
## Contributing to `cargo component`
296292

297293
`cargo component` is a [Bytecode Alliance](https://bytecodealliance.org/)
298-
project, and follows
299-
the Bytecode Alliance's [Code of Conduct](CODE_OF_CONDUCT.md) and
300-
[Organizational Code of Conduct](ORG_CODE_OF_CONDUCT.md).
294+
project, and follows the Bytecode Alliance's [Code of Conduct](CODE_OF_CONDUCT.md)
295+
and [Organizational Code of Conduct](ORG_CODE_OF_CONDUCT.md).
301296

302297
### Getting the Code
303298

@@ -333,14 +328,10 @@ command. This is checked on CI.
333328
The CI for the `cargo component` repository is relatively significant. It tests
334329
changes on Windows, macOS, and Linux.
335330

336-
It also performs a "dry run" of the release process to ensure that release
337-
binaries can be built and are ready to be published (_coming soon_).
338-
339-
### Publishing (_coming soon_)
331+
### Publishing
340332

341333
Publication of this crate is entirely automated via CI. A publish happens
342334
whenever a tag is pushed to the repository, so to publish a new version you'll
343-
want to make a PR that bumps the version numbers (see the `bump.rs` scripts in
344-
the root of the repository), merge the PR, then tag the PR and push the tag.
345-
That should trigger all that's necessary to publish all the crates and binaries
346-
to crates.io.
335+
want to make a PR that bumps the version numbers (see the `ci/publish.rs`
336+
script), merge the PR, then tag the PR and push the tag. That should trigger
337+
all that's necessary to publish all the crates and binaries to crates.io.

0 commit comments

Comments
 (0)