-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (135 loc) · 4.53 KB
/
Copy pathpublish-rust.yml
File metadata and controls
158 lines (135 loc) · 4.53 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Publish Rust Crates
on:
release:
types:
- published
permissions:
contents: read
concurrency:
group: publish-rust-${{ github.event.release.tag_name || github.ref_name }}
cancel-in-progress: false
jobs:
resolve-version:
uses: ./.github/workflows/resolve-release-version.yml
with:
release_tag: ${{ github.event.release.tag_name || '' }}
ref_name: ${{ github.ref_name }}
ref_type: ${{ github.ref_type }}
missing_message: "Publish a GitHub Release or run this workflow on a tag ref."
version-check:
needs: resolve-version
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: refs/tags/${{ needs.resolve-version.outputs.tag_name }}
persist-credentials: false
- name: Validate release ref
shell: bash
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
REF_TYPE: ${{ github.ref_type }}
run: |
if [ -z "$RELEASE_TAG" ] && [ "$REF_TYPE" != "tag" ]; then
echo "::error::Rust crates may only be published from a version tag."
exit 1
fi
- name: Validate lockstep versions against tag
run: python3 scripts/manage_versions.py check --tag "${{ needs.resolve-version.outputs.version }}"
package-check:
needs: [resolve-version, version-check]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: refs/tags/${{ needs.resolve-version.outputs.tag_name }}
persist-credentials: false
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.94.0
- name: Verify Rust crates package cleanly
run: cargo package --manifest-path rust/Cargo.toml -p tstring-syntax -p tstring-json -p tstring-toml -p tstring-yaml
publish-syntax:
needs: [resolve-version, package-check]
runs-on: ubuntu-latest
permissions:
contents: read
environment:
name: crates-io
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: refs/tags/${{ needs.resolve-version.outputs.tag_name }}
persist-credentials: false
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.94.0
- name: Publish tstring-syntax
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --manifest-path rust/Cargo.toml -p tstring-syntax
publish-json:
needs: [resolve-version, publish-syntax]
runs-on: ubuntu-latest
permissions:
contents: read
environment:
name: crates-io
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: refs/tags/${{ needs.resolve-version.outputs.tag_name }}
persist-credentials: false
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.94.0
- name: Wait for tstring-syntax to appear on crates.io
run: python3 .github/scripts/wait_for_crate.py tstring-syntax
- name: Publish tstring-json
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --manifest-path rust/Cargo.toml -p tstring-json
publish-toml:
needs: [resolve-version, publish-json]
runs-on: ubuntu-latest
permissions:
contents: read
environment:
name: crates-io
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: refs/tags/${{ needs.resolve-version.outputs.tag_name }}
persist-credentials: false
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.94.0
- name: Publish tstring-toml
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --manifest-path rust/Cargo.toml -p tstring-toml
publish-yaml:
needs: [resolve-version, publish-toml]
runs-on: ubuntu-latest
permissions:
contents: read
environment:
name: crates-io
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: refs/tags/${{ needs.resolve-version.outputs.tag_name }}
persist-credentials: false
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.94.0
- name: Publish tstring-yaml
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --manifest-path rust/Cargo.toml -p tstring-yaml