Skip to content

Commit a5abc6e

Browse files
committed
ci: Add Node.js and semantic release setup to Dockerfile and release workflow
Signed-off-by: Eden Reich <eden.reich@gmail.com>
1 parent 80aab3d commit a5abc6e

File tree

3 files changed

+101
-42
lines changed

3 files changed

+101
-42
lines changed

.devcontainer/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ FROM mcr.microsoft.com/devcontainers/rust:1.0.20-bookworm
22

33
ENV ZSH_CUSTOM=/home/vscode/.oh-my-zsh/custom
44

5+
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
6+
apt-get update && \
7+
apt-get install -y nodejs && \
8+
apt-get clean && \
9+
rm -rf /var/lib/apt/lists/*
10+
11+
RUN npm install -g semantic-release @semantic-release/changelog @semantic-release/exec @semantic-release/git @semantic-release/github conventional-changelog-conventionalcommits
12+
513
RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM}/themes/powerlevel10k
614

715
USER vscode

.github/workflows/release.yml

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,35 @@
11
name: Release
22

33
on:
4-
push:
5-
tags:
6-
- "v[0-9]+.[0-9]+.[0-9]+*"
4+
workflow_dispatch:
75

86
env:
97
CARGO_TERM_COLOR: always
108
REGISTRY: crates.io
119

1210
jobs:
13-
publish:
14-
runs-on: ubuntu-24.04
15-
name: Publish
16-
steps:
17-
- uses: actions/checkout@v4
11+
# publish:
12+
# runs-on: ubuntu-24.04
13+
# name: Publish
14+
# steps:
15+
# - uses: actions/checkout@v4
1816

19-
- name: Install Rust
20-
uses: dtolnay/rust-toolchain@stable
17+
# - name: Install Rust
18+
# uses: dtolnay/rust-toolchain@stable
2119

22-
- name: Cache dependencies
23-
uses: Swatinem/rust-cache@v2
20+
# - name: Cache dependencies
21+
# uses: Swatinem/rust-cache@v2
2422

25-
- name: Run tests
26-
run: cargo test --verbose
23+
# - name: Build
24+
# run: cargo build --verbose --release
2725

28-
- name: Build
29-
run: cargo build --verbose --release
30-
31-
- name: Publish to crates.io
32-
env:
33-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
34-
run: cargo publish
26+
# - name: Publish to crates.io
27+
# env:
28+
# CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
29+
# run: cargo publish
3530

3631
github_release:
37-
needs: publish
32+
# needs: publish
3833
name: GitHub Release
3934
runs-on: ubuntu-24.04
4035
permissions:
@@ -43,32 +38,27 @@ jobs:
4338
- uses: actions/checkout@v4
4439
with:
4540
fetch-depth: 0
41+
persist-credentials: false
42+
ref: main
4643

4744
- name: Setup Node.js
4845
uses: actions/setup-node@v4
4946
with:
5047
node-version: "lts/*"
5148

52-
- name: Generate Release Notes
53-
id: semantic_release
54-
uses: cycjimmy/semantic-release-action@v4
55-
with:
56-
semantic_version: 20
57-
extra_plugins: |
58-
@semantic-release/changelog
59-
@semantic-release/git
60-
conventional-changelog-conventionalcommits
61-
branches: |
62-
['main']
63-
env:
64-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
- name: Install semantic release and plugins
50+
run: |
51+
npm install -g semantic-release \
52+
conventional-changelog-cli \
53+
conventional-changelog-conventionalcommits \
54+
@semantic-release/changelog \
55+
@semantic-release/exec \
56+
@semantic-release/git \
57+
@semantic-release/github
6558
66-
- name: Create Release
67-
uses: softprops/action-gh-release@v2
68-
with:
69-
body: ${{ steps.semantic_release.outputs.notes }}
70-
generate_release_notes: true
71-
draft: false
72-
prerelease: false
59+
- name: Create a release if needed
60+
run: |
61+
semantic-release --branches main,next
7362
env:
63+
CI: true
7464
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.releaserc.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
initalVersion: "0.1.0"
2+
branches:
3+
- main
4+
tagFormat: ${version}
5+
plugins:
6+
- [
7+
"@semantic-release/commit-analyzer",
8+
{
9+
preset: "conventionalcommits",
10+
releaseRules:
11+
[
12+
{ type: "feat", release: "patch" },
13+
{ type: "impr", release: "patch" },
14+
{ type: "refactor", release: "patch" },
15+
{ type: "perf", release: "patch" },
16+
{ type: "fix", release: "patch" },
17+
{ type: "ci", release: "patch" },
18+
{ type: "docs", release: "patch" },
19+
{ type: "chore", release: "patch" },
20+
{ type: "style", release: "patch" },
21+
{ type: "test", release: "patch" },
22+
{ type: "build", release: "patch" },
23+
],
24+
},
25+
]
26+
- [
27+
"@semantic-release/release-notes-generator",
28+
{
29+
preset: "conventionalcommits",
30+
presetConfig:
31+
{
32+
types:
33+
[
34+
{ type: "feat", section: "✨ Features" },
35+
{ type: "impr", section: "🚀 Improvements" },
36+
{ type: "refactor", section: "♻️ Improvements" },
37+
{ type: "perf", section: "⚡️ Improvements" },
38+
{ type: "fix", section: "🐛 Bug Fixes" },
39+
{ type: "ci", section: "👷 CI" },
40+
{ type: "docs", section: "📚 Documentation" },
41+
{ type: "chore", section: "🔧 Miscellaneous" },
42+
{ type: "style", section: "🎨 Miscellaneous" },
43+
{ type: "test", section: "✅ Miscellaneous" },
44+
{ type: "build", section: "📦 Miscellaneous" },
45+
],
46+
},
47+
},
48+
]
49+
- ["@semantic-release/changelog", { "changelogFile": "CHANGELOG.md" }]
50+
- [
51+
"@semantic-release/exec",
52+
{
53+
"prepareCmd": 'sed -i ''s/^version = .*$/version = "${nextRelease.version}"/'' Cargo.toml && cargo check',
54+
},
55+
]
56+
- "@semantic-release/github"
57+
- [
58+
"@semantic-release/git",
59+
{ "assets": ["CHANGELOG.md", "Cargo.lock", "Cargo.toml"] },
60+
]
61+
repositoryUrl: "https://github.com/edenreich/inference-gateway-rust-sdk"

0 commit comments

Comments
 (0)