Skip to content

Commit b79f38d

Browse files
authored
Merge pull request #58 from spacesprotocol/releases
feat: add release-plz, CI, and publish fabric-rs to crates.io
2 parents 2a153dd + 6396725 commit b79f38d

48 files changed

Lines changed: 1086 additions & 798 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.commitlintrc.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
extends:
2+
- '@commitlint/config-conventional'
3+
4+
rules:
5+
header-max-length: [2, always, 100]
6+
type-enum:
7+
- 2
8+
- always
9+
- - build
10+
- chore
11+
- ci
12+
- docs
13+
- feat
14+
- fix
15+
- perf
16+
- refactor
17+
- revert
18+
- style
19+
- test

.github/workflows/commitlint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Commitlint
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, edited, synchronize]
6+
7+
jobs:
8+
commitlint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
- uses: wagoid/commitlint-github-action@v6
15+
with:
16+
configFile: .commitlintrc.yml

.github/workflows/publish-go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Publish Go
33
on:
44
push:
55
tags:
6-
- "v*"
6+
- "fabric-v*"
77
workflow_dispatch:
88

99
permissions:

.github/workflows/publish-js.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Publish JS packages
33
on:
44
push:
55
tags:
6-
- "v*"
6+
- "fabric-v*"
77
workflow_dispatch:
88

99
jobs:
@@ -26,7 +26,7 @@ jobs:
2626
- name: Determine version
2727
id: version
2828
run: |
29-
VERSION="${GITHUB_REF_NAME#v}"
29+
VERSION="${GITHUB_REF_NAME#fabric-v}"
3030
if [[ ! "$GITHUB_REF" == refs/tags/* ]]; then
3131
VERSION="0.0.0-dev.$(date +%Y%m%d%H%M%S)"
3232
fi

.github/workflows/publish-kotlin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Publish Kotlin
33
on:
44
push:
55
tags:
6-
- "v*"
6+
- "fabric-v*"
77
workflow_dispatch:
88

99
permissions:
@@ -21,7 +21,7 @@ jobs:
2121
- name: Determine version
2222
id: version
2323
run: |
24-
VERSION="${GITHUB_REF_NAME#v}"
24+
VERSION="${GITHUB_REF_NAME#fabric-v}"
2525
if [[ ! "$GITHUB_REF" == refs/tags/* ]]; then
2626
VERSION="0.0.0-dev.$(date +%Y%m%d%H%M%S)"
2727
fi

.github/workflows/publish-python.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Publish Python
33
on:
44
push:
55
tags:
6-
- "v*"
6+
- "fabric-v*"
77
workflow_dispatch:
88

99
permissions:
@@ -25,7 +25,7 @@ jobs:
2525
- name: Determine version
2626
id: version
2727
run: |
28-
VERSION="${GITHUB_REF_NAME#v}"
28+
VERSION="${GITHUB_REF_NAME#fabric-v}"
2929
if [[ ! "$GITHUB_REF" == refs/tags/* ]]; then
3030
VERSION="0.0.0-dev.$(date +%Y%m%d%H%M%S)"
3131
fi

.github/workflows/publish-swift.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Publish Swift
33
on:
44
push:
55
tags:
6-
- "v*"
6+
- "fabric-v*"
77
workflow_dispatch:
88

99
permissions:

.github/workflows/release-plz.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release-plz
2+
3+
permissions:
4+
pull-requests: write
5+
contents: write
6+
7+
on:
8+
push:
9+
branches: [main]
10+
11+
jobs:
12+
release-plz-pr:
13+
name: Release-plz PR
14+
runs-on: ubuntu-latest
15+
if: ${{ github.repository_owner == 'spacesprotocol' }}
16+
concurrency:
17+
group: release-plz-${{ github.ref }}
18+
cancel-in-progress: false
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
- uses: dtolnay/rust-toolchain@stable
24+
- name: Run release-plz
25+
uses: release-plz/action@v0.5
26+
with:
27+
command: release-pr
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
31+
32+
release-plz-release:
33+
name: Release-plz publish
34+
runs-on: ubuntu-latest
35+
if: ${{ github.repository_owner == 'spacesprotocol' }}
36+
steps:
37+
- uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
41+
- uses: dtolnay/rust-toolchain@stable
42+
- name: Run release-plz
43+
uses: release-plz/action@v0.5
44+
with:
45+
command: release
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
48+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

.github/workflows/snippets.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Extract code snippets
22

33
on:
44
push:
5-
paths:
6-
- "fabric/examples/**"
5+
tags:
6+
- "fabric-v*"
77
workflow_dispatch:
88

99
permissions:
@@ -17,8 +17,29 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v4
1919

20+
- name: Determine versions
21+
id: version
22+
run: |
23+
if [[ "$GITHUB_REF" == refs/tags/fabric-v* ]]; then
24+
echo "version=${GITHUB_REF_NAME#fabric-v}" >> "$GITHUB_OUTPUT"
25+
else
26+
echo "version=latest" >> "$GITHUB_OUTPUT"
27+
fi
28+
# Pull libveritas version from what we actually depend on
29+
LV_VERSION=$(grep 'libveritas-jvm' fabric/kotlin/build.gradle.kts | head -1 | sed 's/.*:\([0-9][^"]*\).*/\1/')
30+
echo "lv_version=$LV_VERSION" >> "$GITHUB_OUTPUT"
31+
2032
- name: Extract snippets
2133
run: |
34+
VERSION="${{ steps.version.outputs.version }}"
35+
LV_VERSION="${{ steps.version.outputs.lv_version }}"
36+
37+
# Replace version placeholders in example files
38+
find fabric/examples -type f \( -name "*.rs" -o -name "*.mjs" -o -name "*.go" -o -name "*.py" -o -name "*.kt" -o -name "*.swift" \) \
39+
-exec sed -i "s/{{VERSION}}/$VERSION/g" {} + && \
40+
find fabric/examples -type f \( -name "*.rs" -o -name "*.mjs" -o -name "*.go" -o -name "*.py" -o -name "*.kt" -o -name "*.swift" \) \
41+
-exec sed -i "s/{{LV_VERSION}}/$LV_VERSION/g" {} +
42+
2243
cd fabric/examples
2344
mkdir -p /tmp/snippets
2445

.github/workflows/test.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install Rust
20+
uses: dtolnay/rust-toolchain@stable
21+
22+
- uses: Swatinem/rust-cache@v2
23+
24+
- name: Build
25+
run: cargo build -p fabric-rs -p relay
26+
27+
- name: Run tests
28+
run: cargo test -p fabric-rs
29+
30+
lint:
31+
name: Lint
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: dtolnay/rust-toolchain@stable
36+
with:
37+
components: rustfmt, clippy
38+
- uses: Swatinem/rust-cache@v2
39+
- run: cargo fmt --all -- --check
40+
- run: cargo clippy -p fabric-rs -p relay --all-features -- -D warnings

0 commit comments

Comments
 (0)