forked from Kimahriman/hdfs-native
-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (33 loc) · 1.03 KB
/
rust-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
name: rust-release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
validate-release-tag:
name: Validate git tag
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- name: compare git tag with cargo metadata
run: |
PUSHED_TAG=${GITHUB_REF##*/}
CURR_VER=$( grep version rust/Cargo.toml | head -n 1 | awk '{print $3}' | tr -d '"' )
if [[ "${PUSHED_TAG}" != "v${CURR_VER}" ]]; then
echo "Cargo metadata has version set to ${CURR_VER}, but got pushed tag ${PUSHED_TAG}."
exit 1
fi
release:
name: Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Publish hdfs-native to crates.io
run: cargo publish -p hdfs-native --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}