-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (68 loc) · 2.33 KB
/
release.yaml
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
# Attempts to perform a release when a particular tag is pushed. This job uses
# the `cargo release` command and assumes that the `CRATES_TOKEN`secret has
# been set and contains an API token with which we can publish our crates to
# crates.io.
#
# The `ibc-derive` publishing process is managed manually since it's not
# consistently published with every release.
#
# If release operation fails partway through due to a temporary error (e.g. the
# crate being published depends on the crate published just prior, but the prior
# crate isn't yet available via crates.io), one can simply rerun this workflow.
name: Release
on:
push:
branches:
- "release/*"
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v0.26.0, v1.0.0
- "v[0-9]+.[0-9]+.[0-9]+-pre.[0-9]+" # e.g. v0.26.0-pre.1
jobs:
publish-check:
if: github.ref_type != 'tag'
name: Check publish to crates.io (dry run)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install `cargo-release` from crates.io
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-release
- name: Publish crates (dry run)
run: make check-release
publish:
if: github.ref_type == 'tag'
name: Publish to crates.io
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install `cargo-release` from crates.io
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-release
- name: Publish crates
run: yes | make release
env:
# https://doc.rust-lang.org/cargo/commands/cargo-publish.html#options
# argument for `--token` is specified with this environment variable
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
gh-release:
if: github.ref_type == 'tag'
needs: publish
name: Create GitHub release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: taiki-e/create-gh-release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}