-
Notifications
You must be signed in to change notification settings - Fork 7
117 lines (96 loc) · 3.14 KB
/
release.yml
File metadata and controls
117 lines (96 loc) · 3.14 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
name: Release
on:
push:
tags:
- 'v*.*.*'
- 'v*.*.*-*'
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run (do not actually publish)'
required: false
default: true
type: boolean
env:
CARGO_TERM_COLOR: always
jobs:
verify:
name: Verify Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.90"
components: clippy, rustfmt
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run tests
run: cargo test --all-targets --all-features
- name: Build documentation
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --no-deps --all-features
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
needs: verify
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.90"
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Verify crates can be packaged
run: |
cargo package -p aptos-sdk-macros --locked
cargo package -p aptos-sdk --locked
# Publish macros crate first (aptos-sdk depends on it)
- name: Publish aptos-sdk-macros (dry run)
if: inputs.dry_run == true
run: cargo publish -p aptos-sdk-macros --locked --dry-run
- name: Publish aptos-sdk-macros
if: inputs.dry_run != true || github.event_name == 'push'
run: cargo publish -p aptos-sdk-macros --locked
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
# Wait for crates.io to index the macros crate (120s for reliability during high load)
- name: Wait for crates.io indexing
if: inputs.dry_run != true || github.event_name == 'push'
run: sleep 120
# Publish main SDK crate
- name: Publish aptos-sdk (dry run)
if: inputs.dry_run == true
run: cargo publish -p aptos-sdk --locked --dry-run
- name: Publish aptos-sdk
if: inputs.dry_run != true || github.event_name == 'push'
run: cargo publish -p aptos-sdk --locked
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
release-notes:
name: Create Release Notes
runs-on: ubuntu-latest
needs: publish
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Generate release notes
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
draft: false
prerelease: ${{ contains(github.ref, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}