Skip to content

Commit 50bb7e7

Browse files
authored
Merge pull request #3 from hearnadam/master
add ci to publish to crates
2 parents c7a09a2 + ea66b7f commit 50bb7e7

File tree

3 files changed

+75
-2
lines changed

3 files changed

+75
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
branches:
8+
- main
9+
pull_request:
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
build:
16+
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: actions/cache@v3
21+
with:
22+
path: |
23+
~/.cargo/bin/
24+
~/.cargo/registry/index/
25+
~/.cargo/registry/cache/
26+
~/.cargo/git/db/
27+
target/
28+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-is
29+
- name: Setup Rust
30+
uses: actions-rs/toolchain@v1
31+
with:
32+
toolchain: stable
33+
override: true
34+
- name: Check formatting
35+
run: cargo fmt -- --check
36+
- name: Clippy
37+
run: cargo clippy -- -Dwarnings
38+
- name: Tests
39+
run: cargo test --all-features
40+
41+
publish:
42+
needs: [ build ]
43+
if: "startsWith(github.ref, 'refs/tags/v')"
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v3
48+
with:
49+
submodules: true
50+
- uses: actions/cache@v3
51+
with:
52+
path: |
53+
~/.cargo/bin/
54+
~/.cargo/registry/index/
55+
~/.cargo/registry/cache/
56+
~/.cargo/git/db/
57+
target/
58+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-is
59+
60+
- name: Setup Rust
61+
uses: actions-rs/toolchain@v1
62+
with:
63+
toolchain: stable
64+
override: true
65+
- id: get_version
66+
uses: battila7/get-version-action@v2
67+
- name: Publish crate
68+
env:
69+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
70+
run: |
71+
export VERSION="${{ steps.get_version.outputs.version-without-v }}"
72+
sed -i "s/0.0.0/$VERSION/g" Cargo.toml
73+
cargo publish --all-features --allow-dirty

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "golem-scalajs-wit-bindgen"
33
description = "Golem Cloud CLI tool for generating Scala.js bindings from a WIT file"
4-
version = "0.1.0"
4+
version = "0.0.0"
55
edition = "2021"
66
license = "Apache-2.0"
77
homepage = "https://www.golem.cloud/"

0 commit comments

Comments
 (0)