-
-
Notifications
You must be signed in to change notification settings - Fork 4
84 lines (66 loc) · 1.83 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
73
74
75
76
77
78
79
80
81
82
83
84
name: Release
on:
push:
tags: ["v*.*.*"]
jobs:
build:
permissions:
id-token: write
attestations: write
uses: ./.github/workflows/build.yml
crates-io:
name: crates.io
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Publish
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }}
github:
name: GitHub Releases
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install git-cliff
uses: taiki-e/install-action@git-cliff
- name: Download artifacts
id: download
uses: actions/download-artifact@v4
with:
path: /tmp/artifacts
- name: Prepare assets
env:
ARTIFACTS: ${{ steps.download.outputs.download-path }}
id: prepare
run: |
asset_path="/tmp/assets"
mkdir -p "$asset_path"
for artifact in "$ARTIFACTS"/*/; do
basename "$artifact" | \
xargs -I {} zip -jr "$asset_path"/{}.zip "$artifact"
done
- name: Generate changelog
run: git-cliff -l --strip all | tail -n +3 > /tmp/changelog.md
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
run: |
gh release create --notes-file /tmp/changelog.md --draft --verify-tag "$TAG" /tmp/assets/*.zip