-
Notifications
You must be signed in to change notification settings - Fork 1
33 lines (30 loc) · 895 Bytes
/
publish.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
name: Publish
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
check:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.check-branch.outputs.value }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
fetch-depth: 0
- run: git branch -a --contains ${{ github.ref_name }} 2> /dev/null | grep -q ' main' && echo "value=true" >> "$GITHUB_OUTPUT" || exit 0
id: check-branch
publish:
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.result == 'true'
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Make sure crate is ready
run: cargo publish --dry-run
- name: Publish the crate
run: cargo publish --token ${{ secrets.CRATES_TOKEN }}