-
Notifications
You must be signed in to change notification settings - Fork 6
42 lines (34 loc) · 1.26 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
name: Create GitHub release and publish crate to crates.io
on:
push:
tags:
- "v*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get release version from tag
id: get_tag_version
run: echo ::set-output name=version::${GITHUB_REF#refs/tags/v}
- name: Get crate version from Cargo.toml
id: get_crate_version
run: echo ::set-output name=version::$(cargo read-manifest | jq -r .version)
- name: Assert tag version matches crate version
run: echo ${{ steps.get_tag_version.outputs.version }} != ${{ steps.get_crate_version.outputs.version }} && exit 1
if: ${{ steps.get_tag_version.outputs.version != steps.get_crate_version.outputs.version }}
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: hcloud-rust v${{ steps.get_tag_version.outputs.version }}
draft: true
- name: Publish crate to crates.io
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CARGO_REGISTRY_TOKEN }}