generated from sksat/rust-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (75 loc) · 2.28 KB
/
release.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
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
name: Release
on:
push:
tags:
- 'v*'
pull_request:
paths:
- '.github/workflows/release.yml'
permissions:
contents: write
env:
CARGO_INCREMENTAL: 0
jobs:
release:
runs-on: ubuntu-latest
needs: gen_doc
steps:
- uses: actions/checkout@v4.2.2
- name: Release
uses: softprops/action-gh-release@v2.2.1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
prerelease: true
generate_release_notes: true
publish:
runs-on: ubuntu-latest
needs: gen_doc
steps:
- uses: actions/checkout@v4.2.2
- name: Get Rust toolchain
id: toolchain
run: |
awk -F'[ ="]+' '$1 == "channel" { print "toolchain=" $2 }' rust-toolchain >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ steps.toolchain.outputs.toolchain }}
- name: prepare for package(download jsonschema for docs.rs build)
run: |
cargo clean
cargo build --features build-with-local-schema
- name: check downloaded jsonschema
run: |
ls json_schema/*.jsonschema
- name: package
run: |
cargo package --features build-with-local-schema --allow-dirty
- name: check package
run: |
echo "$ ls"; ls
echo "$ ls target/package"; ls target/package/
echo "$ ls target/package/rdfmt-*/json_schema"; ls target/package/rdfmt-*/json_schema
- name: publish(dry run)
run: |
cargo publish --features default,build-with-local-schema --allow-dirty --dry-run
- name: publish
if: startsWith(github.ref, 'refs/tags/')
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish --features default,build-with-local-schema --allow-dirty
gen_doc:
name: generate document test for docs.rs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- name: remove rust-toolchain for set docs.rs Rust version
run: rm rust-toolchain
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly-2024-06-23
- name: check cargo version
run: cargo --version
- name: gen doc
run: cargo doc