-
Notifications
You must be signed in to change notification settings - Fork 2
69 lines (57 loc) · 2.3 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
on:
push:
# Only on tags:
tags: '*.*.*'
name: release
jobs:
publish:
name: Publishes to crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-wasi
override: true
- uses: actions-rs/cargo@v1
- name: Check that the tag matches the crate version.
run: |
cargo update
C_VER="$(cargo pkgid | cut -d'#' -f2)"
T_VER=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
if [[ "${C_VER}" != "${T_VER}" ]]; then
echo "Crate version doesn't match the tag version! (`${C_VER}` vs `${T_VER}`)"
exit 2
fi
- name: Check that this version has a changelog entry and the right root_url
id: ver
run: |
T_VER=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
echo "::set-output name=version::${T_VER}"
echo "::set-output name=tag::$(echo "${T_VER}" | sed -e 's/\.//g')"
grep -q "# ${T_VER}" CHANGELOG.md || exit 3
# We want to have the exact version of this crate in the root URL so
# that newer releases don't cause users of older versions of this
# crate to have their links go to the wrong place.
#
# i.e. if we were to use docs.rs/crate-name/* as `html_root_url` and
# had a 0.1.0 release and a 0.2.0 release, users of the 0.1.0 release
# would have their links to types in our crate be prefixed with
# `docs.rs/crate-name/*` which will send them to the 0.2.0 docs.
grep -q "html_root_url = \"https://docs.rs/.*/${T_VER}\"" src/lib.rs || exit 4
- name: Publish
run: |
cargo publish --token ${{ secrets.CARGO_TOKEN }}
- name: Create Release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: v${{ steps.ver.outputs.version }}
body: |
Check the [changelog](https://github.com/rrbutani/xterm-js-sys/blob/${{ steps.ver.outputs.version }}/CHANGELOG.md#${{ steps.ver.outputs.tag }}).
draft: false
prerelease: false