-
Notifications
You must be signed in to change notification settings - Fork 8
116 lines (104 loc) · 3.19 KB
/
release.yml
File metadata and controls
116 lines (104 loc) · 3.19 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get tag
id: tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
- name: Generate changelog
id: changelog
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --latest --strip header
- name: Create draft release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ steps.tag.outputs.tag }}
CHANGELOG: ${{ steps.changelog.outputs.content }}
run: |
gh release create "$TAG" --draft --title "$TAG" --notes "$CHANGELOG"
build:
name: Build ${{ matrix.target }}
needs: create-release
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
cross: false
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
cross: false
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
cross: true
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
cross: true
- target: x86_64-apple-darwin
os: macos-14
cross: false
- target: aarch64-apple-darwin
os: macos-latest
cross: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libdbus-1-dev libsecret-1-dev
if [ "${{ matrix.target }}" = "x86_64-unknown-linux-musl" ]; then
sudo apt-get install -y musl-tools
fi
- name: Install cross
if: matrix.cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build
run: |
if [ "${{ matrix.cross }}" = "true" ]; then
cross build --release --target ${{ matrix.target }}
else
cargo build --release --target ${{ matrix.target }}
fi
shell: bash
- name: Package
env:
TAG: ${{ needs.create-release.outputs.tag }}
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../claudex-${TAG}-${{ matrix.target }}.tar.gz claudex
- name: Upload
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ needs.create-release.outputs.tag }}
run: gh release upload "$TAG" claudex-${TAG}-${{ matrix.target }}.tar.gz
publish-release:
name: Publish Release
needs: [create-release, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Publish release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ needs.create-release.outputs.tag }}
run: gh release edit "$TAG" --draft=false