-
-
Notifications
You must be signed in to change notification settings - Fork 4
99 lines (79 loc) · 2.61 KB
/
Copy pathrelease.yml
File metadata and controls
99 lines (79 loc) · 2.61 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
#
# SPDX-License-Identifier: GPL-3.0-or-later
name: Release
on:
push:
tags: ["v*.*.*"]
permissions:
contents: read
jobs:
build:
permissions:
contents: read
id-token: write
attestations: write
uses: ./.github/workflows/build.yml
with:
disable-cache: true
crates-io:
name: crates.io
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # ratchet:actions/checkout@v6
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # ratchet:dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Authenticate with crates.io
uses: rust-lang/crates-io-auth-action@bbd81622f20ce9e2dd9622e3218b975523e45bbe # ratchet:rust-lang/crates-io-auth-action@v1
id: auth
- name: Publish
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
github:
name: GitHub Releases
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # ratchet:actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Install git-cliff
uses: taiki-e/install-action@59012be0884e296ca2da49b530610e72c49039ad # ratchet:taiki-e/install-action@git-cliff
- name: Download artifacts
id: download
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # ratchet:actions/download-artifact@v8.0.1
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 --current --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