Skip to content

Commit 2e728da

Browse files
committed
bump
1 parent 25cc5b7 commit 2e728da

File tree

8 files changed

+93
-47
lines changed

8 files changed

+93
-47
lines changed

.github/scripts/detect-changes.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
changed_crates=()
4+
5+
echo "Checking changes between HEAD^ and HEAD..."
6+
changed_files=$(git diff --name-only HEAD^ HEAD)
7+
echo "Changed files:"
8+
echo "$changed_files"
9+
10+
echo "Checking crates directory..."
11+
ls -la ./crates/
12+
13+
for crate in ./crates/*; do
14+
echo "Processing: $crate"
15+
if [ -d "$crate" ]; then
16+
crate_name=$(basename "$crate")
17+
echo "Found directory: $crate_name"
18+
echo "Looking for pattern: crates/$crate_name/"
19+
if echo "$changed_files" | grep -q "crates/$crate_name/"; then
20+
echo "Found changes in $crate_name"
21+
changed_crates+=("$crate_name")
22+
else
23+
echo "No changes found in $crate_name"
24+
fi
25+
else
26+
echo "Not a directory: $crate"
27+
fi
28+
done
29+
30+
echo "Found changed crates: ${changed_crates[*]}"
31+
32+
if [ ${#changed_crates[@]} -eq 0 ]; then
33+
echo "matrix={\"component\":[]}" >> "$GITHUB_OUTPUT"
34+
else
35+
json_array=$(printf '"%s",' "${changed_crates[@]}" | sed 's/,$//')
36+
echo "matrix={\"component\":[$json_array]}" >> "$GITHUB_OUTPUT"
37+
fi

.github/workflows/cd.yml

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
env:
99
CARGO_TERM_COLOR: always
1010

11+
permissions:
12+
contents: read
13+
packages: write
14+
1115
jobs:
1216
detect-changes:
1317
runs-on: ubuntu-latest
@@ -17,35 +21,9 @@ jobs:
1721
- uses: actions/checkout@v4
1822
with:
1923
fetch-depth: 0
20-
21-
- name: Get changed files
22-
id: changed-files
23-
uses: tj-actions/changed-files@v41
24-
25-
- name: Discover changed crates
26-
id: set-matrix
27-
run: |
28-
# Get all workspace members
29-
crates=$(cargo metadata --format-version=1 | jq -r '.workspace_members[]' | cut -d'#' -f1 | rev | cut -d'/' -f1 | rev)
30-
31-
changed_crates=()
32-
for crate in $crates; do
33-
# Get crate path from metadata
34-
crate_path=$(cargo metadata --format-version=1 | jq -r ".packages[] | select(.name == \"$crate\") | .manifest_path" | xargs dirname)
35-
36-
# Check if any files in this crate changed
37-
if echo "${{ steps.changed-files.outputs.all_changed_files }}" | grep -q "$crate_path"; then
38-
changed_crates+=("$crate")
39-
fi
40-
done
41-
42-
# Convert to JSON matrix
43-
if [ ${#changed_crates[@]} -eq 0 ]; then
44-
echo "matrix={\"component\":[]}" >> $GITHUB_OUTPUT
45-
else
46-
matrix=$(printf '%s\n' "${changed_crates[@]}" | jq -R . | jq -s .)
47-
echo "matrix={\"component\":$matrix}" >> $GITHUB_OUTPUT
48-
fi
24+
- run: chmod +x .github/scripts/detect-changes.sh
25+
- id: set-matrix
26+
run: .github/scripts/detect-changes.sh
4927

5028
build-and-publish:
5129
needs: detect-changes
@@ -55,13 +33,32 @@ jobs:
5533
matrix:
5634
component: ${{ fromJson(needs.detect-changes.outputs.matrix).component }}
5735
steps:
36+
# Setup
5837
- uses: actions/checkout@v4
5938
- uses: dtolnay/rust-toolchain@nightly
6039
- uses: Swatinem/rust-cache@v2
61-
- run: cargo install --locked wkg
40+
- uses: cargo-bins/cargo-binstall@main
41+
- run: cargo binstall --locked --force cargo-component
42+
- run: cargo binstall --locked --force wkg
6243

6344
# Build
64-
- run: cargo component build -p {{component}} --release
45+
- run: cargo component build -p ${{ matrix.component }} --release
46+
47+
# Authentication
48+
- uses: docker/login-action@v3
49+
with:
50+
registry: ghcr.io
51+
username: ${{ github.actor }}
52+
password: ${{ secrets.GITHUB_TOKEN }}
6553

6654
# Publish
67-
- run: wkg oci push ghcr.io/wassemble/{{component}}:latest target/wasm32-wasip1/release/$(echo {{component}} | tr '-' '_').wasm
55+
- run: wkg publish target/wasm32-wasip1/release/$(echo ${{ matrix.component }} | tr '-' '_').wasm --registry ghcr.io
56+
57+
# Make package public
58+
- run: |
59+
echo "Making package public..."
60+
curl -X PATCH \
61+
-H "Accept: application/vnd.github.v3+json" \
62+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
63+
https://api.github.com/user/packages/container/${{ matrix.component }}/visibility \
64+
-d '{"visibility":"public"}'

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ jobs:
1919
with:
2020
components: clippy, rustfmt
2121
- uses: Swatinem/rust-cache@v2
22-
- run: cargo install --locked cargo-machete
23-
- run: cargo install --locked cargo-sort-derives
22+
- uses: cargo-bins/cargo-binstall@main
23+
- run: cargo binstall --locked cargo-machete
24+
- run: cargo binstall --locked cargo-sort-derives
2425

2526
# Checks
2627
- run: cargo +nightly fmt --check

.vscode/settings.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"rust-analyzer.check.overrideCommand": [
3+
"cargo",
4+
"component",
5+
"check",
6+
"--workspace",
7+
"--all-targets",
8+
"--message-format=json"
9+
]
10+
}

crates/discord/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ package = "wassemble:discord"
2020

2121
[package.metadata.component.dependencies]
2222

23-
2423
[package.metadata.component.target.dependencies]
2524
"wasi:cli" = { path = "./wit/deps/wasi-cli-0.2.5" }
2625
"wasi:clocks" = { path = "./wit/deps/wasi-clocks-0.2.5" }

crates/discord/src/bindings.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ pub trait Guest {
590590
) -> _rt::String;
591591
}
592592
#[doc(hidden)]
593-
macro_rules! __export_world_discord_cabi {
593+
macro_rules! __export_world_main_cabi {
594594
($ty:ident with_types_in $($path_to_types:tt)*) => {
595595
const _ : () = { #[unsafe (export_name = "create-webhook")] unsafe extern "C" fn
596596
export_create_webhook(arg0 : * mut u8, arg1 : usize, arg2 : * mut u8, arg3 :
@@ -641,7 +641,7 @@ macro_rules! __export_world_discord_cabi {
641641
};
642642
}
643643
#[doc(hidden)]
644-
pub(crate) use __export_world_discord_cabi;
644+
pub(crate) use __export_world_main_cabi;
645645
#[cfg_attr(target_pointer_width = "64", repr(align(8)))]
646646
#[cfg_attr(target_pointer_width = "32", repr(align(4)))]
647647
struct _RetArea([::core::mem::MaybeUninit<u8>; 9 * ::core::mem::size_of::<*const u8>()]);
@@ -9004,23 +9004,23 @@ mod _rt {
90049004
/// ```
90059005
#[allow(unused_macros)]
90069006
#[doc(hidden)]
9007-
macro_rules! __export_discord_impl {
9007+
macro_rules! __export_main_impl {
90089008
($ty:ident) => {
90099009
self::export!($ty with_types_in self);
90109010
};
90119011
($ty:ident with_types_in $($path_to_types_root:tt)*) => {
9012-
$($path_to_types_root)*:: __export_world_discord_cabi!($ty with_types_in
9012+
$($path_to_types_root)*:: __export_world_main_cabi!($ty with_types_in
90139013
$($path_to_types_root)*);
90149014
};
90159015
}
90169016
#[doc(inline)]
9017-
pub(crate) use __export_discord_impl as export;
9017+
pub(crate) use __export_main_impl as export;
90189018
#[cfg(target_arch = "wasm32")]
9019-
#[unsafe(link_section = "component-type:wit-bindgen:0.41.0:flow:discord@0.1.0:discord:encoded world")]
9019+
#[unsafe(link_section = "component-type:wit-bindgen:0.41.0:wassemble:discord@0.1.0:main:encoded world")]
90209020
#[doc(hidden)]
90219021
#[allow(clippy::octal_escapes)]
9022-
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 7009] = *b"\
9023-
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xe35\x01A\x02\x01A.\x01\
9022+
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 7008] = *b"\
9023+
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xe55\x01A\x02\x01A.\x01\
90249024
ks\x01r\x03\x07contents\x0achannel-ids\x08guild-id\0\x03\0\x07message\x03\0\x01\x01\
90259025
r\x03\x02ids\x05tokens\x03urls\x03\0\x07webhook\x03\0\x03\x01r\x04\x02ids\x08use\
90269026
rnames\x0ddiscriminators\x06avatar\0\x03\0\x04user\x03\0\x05\x01r\x04\x02ids\x04\
@@ -9157,9 +9157,9 @@ sage-ids\x07contents\0\x7f\x04\0\x0cedit-message\x01\x1b\x01@\x02\x05tokens\x0ac
91579157
hannel-ids\0\x08\x04\0\x0bget-channel\x01\x1c\x01@\x02\x05tokens\x07user-ids\0\x06\
91589158
\x04\0\x08get-user\x01\x1d\x01@\x02\x05tokens\x07message\x02\0s\x04\0\x0csend-me\
91599159
ssage\x01\x1e\x01@\x03\x05tokens\x07webhook\x04\x07contents\0s\x04\0\x14send-web\
9160-
hook-message\x01\x1f\x04\0\x1aflow:discord/discord@0.1.0\x04\0\x0b\x0d\x01\0\x07\
9161-
discord\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.22\
9162-
7.1\x10wit-bindgen-rust\x060.41.0";
9160+
hook-message\x01\x1f\x04\0\x1cwassemble:discord/main@0.1.0\x04\0\x0b\x0a\x01\0\x04\
9161+
main\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.227.1\
9162+
\x10wit-bindgen-rust\x060.41.0";
91639163
#[inline(never)]
91649164
#[doc(hidden)]
91659165
pub fn __link_custom_section_describing_imports() {

crates/discord/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ mod bindings;
99

1010
const DISCORD_API_BASE: &str = "https://discord.com/api/v10";
1111

12+
// bump
13+
1214
#[derive(Deserialize, Serialize)]
1315
struct DiscordResponse<T> {
1416
id: String,

crates/discord/wit/world.wit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package wassemble:discord@0.1.0;
22

3-
world discord {
3+
world main {
44
import wasi:http/outgoing-handler@0.2.5;
55

66
record message {

0 commit comments

Comments
 (0)