Skip to content

Commit 1136c89

Browse files
committed
Publish gel-dsn
1 parent cd0434f commit 1136c89

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
on:
2+
push:
3+
tags:
4+
- releases/gel-dsn/v*
5+
6+
name: Release gel-errors
7+
8+
jobs:
9+
test_and_publish:
10+
name: Test and publish
11+
runs-on: ubuntu-latest
12+
permissions:
13+
id-token: "write"
14+
contents: "read"
15+
steps:
16+
- name: checkout and env setup
17+
uses: actions/checkout@v3
18+
19+
- name: Extract project name and version
20+
run: |
21+
set -x
22+
PROJECT_NAME=$(echo $GITHUB_REF | sed -E 's|refs/tags/releases/([^/]+)/v.*|\1|')
23+
VERSION=$(echo $GITHUB_REF | sed -E 's|.*/v(.*)|\1|')
24+
echo "PROJECT_NAME=$PROJECT_NAME" >> $GITHUB_ENV
25+
echo "VERSION=$VERSION" >> $GITHUB_ENV
26+
27+
# verify that git tag matches cargo version
28+
- run: |
29+
set -x
30+
cargo_version="$(cargo metadata --format-version 1 \
31+
| jq -r '.packages[] | select(.name=="${{ env.PROJECT_NAME }}") | .version')"
32+
test "$cargo_version" = "${{ env.VERSION }}"
33+
34+
- name: Install Rust
35+
uses: dtolnay/rust-toolchain@master
36+
with:
37+
toolchain: stable
38+
components: rustfmt, clippy
39+
40+
- working-directory: ./${{ env.PROJECT_NAME }}
41+
run: |
42+
cargo publish --token=${{ secrets.CARGO_REGISTRY_TOKEN }}

0 commit comments

Comments
 (0)