-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (62 loc) · 1.87 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
name: Release
on:
push:
tags:
- "v*"
jobs:
draft-release:
name: Create Release
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.tag.outputs.tag_name }}
steps:
- name: Checkout the repo
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Get tag data
id: tag
run: |
# replace the following commands to use the new GITHUB_OUTPUT syntax
echo "tag_name=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
if [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+-[0-9]+$ ]]; then
echo "pre_release=true" >> $GITHUB_OUTPUT
fi
- name: Create new release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
prerelease: ${{ steps.tag.outputs.pre_release == 'true' }}
title: "Version: ${{ steps.tag.outputs.tag_name }}"
draft: true
publish-release:
name: Publish Release
needs: ["draft-release"]
runs-on: ubuntu-latest
continue-on-error: true
environment: prod
steps:
- name: Checkout the repo
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Login to Crates
uses: actions-rs/cargo@v1
with:
command: login
args: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish Crates
uses: actions-rs/cargo@v1
with:
command: publish
args: --no-verify
- name: Update Release
run: gh release edit ${{ needs.draft-release.outputs.tag_name }} --draft=false --repo=${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}