-
Notifications
You must be signed in to change notification settings - Fork 14
119 lines (100 loc) · 3.09 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Release
on:
workflow_dispatch:
inputs:
publish-tag:
description: 'The tag of the version to publish'
required: true
type: string
concurrency:
group: release
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
jobs:
test-release:
name: Check & Test release
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
- os: macos-latest
- os: ubuntu-latest
env:
CARGO_BUILD_TARGET: wasm32-wasip1
CARGO_TARGET_WASM32_WASI_RUNNER: /home/runner/.wasmtime/bin/wasmtime --dir=.
runs-on: ${{ matrix.os }}
if: github.ref == 'refs/heads/main'
env: ${{ matrix.env || fromJSON('{}') }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install Wasm deps
if: matrix.env.CARGO_BUILD_TARGET == 'wasm32-wasip1'
run: |
rustup target add wasm32-wasip1
curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.deb
sudo dpkg --install wasi-sdk-25.0-x86_64-linux.deb
curl -LO https://github.com/bytecodealliance/wasmtime/releases/download/v13.0.0/wasmtime-v13.0.0-x86_64-linux.tar.xz
tar xvf wasmtime-v13.0.0-x86_64-linux.tar.xz
echo `pwd`/wasmtime-v13.0.0-x86_64-linux >> $GITHUB_PATH
- uses: Swatinem/rust-cache@v2
with:
shared-key: release
save-if: ${{ github.ref_name == 'main' }}
- run: rustup show
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Clippy
run: cargo hack clippy --feature-powerset -- -D warnings
- name: Test
run: cargo hack test --feature-powerset
- name: Check Documentation
env:
RUSTDOCFLAGS: '-D warnings'
run: cargo hack doc --feature-powerset
- name: Check semver
if: matrix.os == 'ubuntu-latest'
uses: obi1kenobi/cargo-semver-checks-action@v2
publish-release:
name: Publish release
needs: test-release
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: true
- uses: taiki-e/install-action@v2
with:
tool: cargo-edit
- name: Update Cargo.toml version
env:
NEW_VERSION: ${{ inputs.publish-tag }}
run: |
VERSION=${NEW_VERSION#v}
cargo set-version "${VERSION}"
git add Cargo.toml
git commit -m "chore: bump version to ${NEW_VERSION}"
git push
- name: Tag the version
env:
GIT_TAG: ${{ inputs.publish-tag }}
run: |+
git tag "${GIT_TAG}"
git push origin "${GIT_TAG}"
- name: Publish to crates.io
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Create github release
uses: taiki-e/create-gh-release-action@v1
with:
branch: main
ref: refs/tags/"${GIT_TAG}"
env:
GIT_TAG: ${{ inputs.publish-tag }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}