-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (42 loc) · 1.22 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
# NOTE: this is stolen from cargo-dist workflow file
# Publishes a release to crates.io
#
# To trigger this:
#
# - go to Actions > Publish
# - click the Run Workflow dropdown in the top-right
# - enter the tag of the release as “Release Tag” (e.g. v0.3.18)
name: Publish
on:
workflow_dispatch:
inputs:
tag:
description: 'Release Tag'
required: true
type: string
jobs:
# This is a bit convoluted so that the other parts of this workflow remain
# the same even if the way the tag is defined is more complicated
download-tag:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.print-tag.outputs.tag }}
steps:
- id: print-tag
run: echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
# publish the current repo state to crates.io
cargo-publish:
runs-on: ubuntu-latest
needs: download-tag
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
ref: ${{needs.download-tag.outputs.tag}}
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- run: cargo publish --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}