Skip to content

Commit 3c3f276

Browse files
committed
CI
1 parent 4afde97 commit 3c3f276

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

.github/workflows/ci.yaml

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

0 commit comments

Comments
 (0)