File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : cargo-publish
2+
3+ on :
4+ push :
5+ tags : ['**']
6+ branches : ['**']
7+ paths :
8+ - " .github/workflows/cargo-publish.yml"
9+ workflow_dispatch :
10+ inputs :
11+ tag :
12+ required : true
13+ type : string
14+
15+ jobs :
16+ publish :
17+ runs-on : ubuntu-latest
18+ steps :
19+ - name : Determine package to publish
20+ run : |
21+ if [[ ${{ github.ref_type }} == 'tag' ]]; then
22+ TAG=${{ github.ref_name }}
23+ echo "PUBLISH_CRATE=true" >> $GITHUB_ENV
24+ elif [[ -n "${{ inputs.tag }}" ]]; then
25+ TAG=${{ inputs.tag }}
26+ echo "Doing a dry run for tag: ${TAG}"
27+ else
28+ TAG=bugbite
29+ echo "Doing a test run for bugbite"
30+ fi
31+
32+ echo "PKG=${TAG%%-[0-9]*}" >> $GITHUB_ENV
33+ echo "VERSION=${TAG##*[a-z]-}" >> $GITHUB_ENV
34+
35+ - name : Checkout code
36+ uses : actions/checkout@v6
37+
38+ - name : Set up rust toolchain
39+ uses : dtolnay/rust-toolchain@stable
40+
41+ - name : Install cargo-nextest
42+ uses : taiki-e/install-action@nextest
43+
44+ - name : Run tests for package
45+ run : cargo nextest run --all-features --tests -p ${PKG}
46+
47+ - name : Clean up git repos
48+ run : |
49+ git clean -fxd
50+ git submodule foreach --recursive git clean -fxd
51+
52+ - name : Publish crate
53+ env :
54+ CARGO_REGISTRY_TOKEN : ${{ secrets.CARGO_REGISTRY_TOKEN }}
55+ run : |
56+ if [[ ${{ github.ref_type }} == 'tag' ]]; then
57+ cargo publish --no-verify -p ${PKG}
58+ elif [[ -n "${{ inputs.tag }}" ]]; then
59+ cargo publish --no-verify --dry-run -p ${PKG}
60+ else
61+ echo "Test run skipping crate publish"
62+ fi
You can’t perform that action at this time.
0 commit comments