-
-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (43 loc) · 1.23 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Publish
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to publish'
required: true
type: string
permissions:
contents: read
jobs:
defines:
name: Define variables
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.print-tag.outputs.tag }}
package: ${{ steps.print-package.outputs.package }}
steps:
- name: Set tag
id: print-tag
run: echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
- name: Set package
id: print-package
run: |
package="${{ inputs.tag }}"
package=${package%%/*}
echo "package=" >> "$GITHUB_OUTPUT"
cargo-publish:
runs-on: ubuntu-latest
needs: defines
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.defines.outputs.tag }}
fetch-depth: 0
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Publish ${{ needs.defines.outputs.package }} to crates.io
run: cargo publish --locked --package "${PACKAGE}" --all-features --token "${CRATESIO_API_TOKEN}"
env:
CRATESIO_API_TOKEN: ${{ secrets.CRATESIO_API_TOKEN }}
PACKAGE: ${{ needs.defines.outputs.package }}