-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (70 loc) · 2.45 KB
/
Copy pathpublish.yml
File metadata and controls
79 lines (70 loc) · 2.45 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Publish
on:
release:
types: [published]
workflow_dispatch:
inputs:
release_tag:
description: "Release tag to publish (e.g. v0.2.0)"
required: true
type: string
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
publish-fetchkit:
name: Publish fetchkit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.event.release.tag_name }}
- name: Install Rust stable
run: |
rustup toolchain install stable --profile minimal
rustup default stable
- name: Verify version matches tag
env:
EVENT_NAME: ${{ github.event_name }}
INPUT_RELEASE_TAG: ${{ inputs.release_tag }}
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
run: |
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
TAG_VERSION="$INPUT_RELEASE_TAG"
else
TAG_VERSION="$RELEASE_TAG_NAME"
fi
if [ -z "$TAG_VERSION" ]; then
echo "Error: release tag is required"
exit 1
fi
TAG_VERSION="${TAG_VERSION#v}"
CARGO_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
echo "Error: Tag version ($TAG_VERSION) does not match Cargo.toml version ($CARGO_VERSION)"
exit 1
fi
echo "Version verified: $TAG_VERSION"
- name: Publish fetchkit to crates.io
run: cargo publish -p fetchkit
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
publish-fetchkit-cli:
name: Publish fetchkit-cli
runs-on: ubuntu-latest
needs: publish-fetchkit
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.event.release.tag_name }}
- name: Install Rust stable
run: |
rustup toolchain install stable --profile minimal
rustup default stable
- name: Wait for crates.io index update
run: sleep 30
- name: Publish fetchkit-cli to crates.io
run: cargo publish -p fetchkit-cli
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}