Skip to content

Commit 6e67341

Browse files
committed
bump
1 parent 25cc5b7 commit 6e67341

File tree

4 files changed

+71
-34
lines changed

4 files changed

+71
-34
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

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,

0 commit comments

Comments
 (0)