Repository navigation
104 lines (89 loc) 路 2.89 KB
/
Copy pathrelease.yml
File metadata and controls
104 lines (89 loc) 路 2.89 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
name: Release
on:
push:
tags:
- "v*.*.*"
env:
CARGO_TERM_COLOR: always
permissions:
contents: write
jobs:
create-release:
name: Create Release
runs-on: ubuntu-22.04
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install git-cliff
uses: taiki-e/install-action@v2
with:
tool: git-cliff
- name: Generate changelog
run: git-cliff --latest --strip header -o CHANGELOG.md
- name: Get version from tag
id: get_version
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ steps.get_version.outputs.version }}
body_path: CHANGELOG.md
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build - ${{ matrix.target }}
needs: create-release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: typer-cli
asset_name: typer-cli-linux-x86_64
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: typer-cli
asset_name: typer-cli-macos-x86_64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: typer-cli
asset_name: typer-cli-macos-arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }} --verbose
- name: Strip binary (Linux/macOS)
if: matrix.os != 'windows-latest'
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
- name: Rename and generate checksum
run: |
cd target/${{ matrix.target }}/release
cp ${{ matrix.artifact_name }} ${{ matrix.asset_name }}
shasum -a 256 ${{ matrix.asset_name }} > ${{ matrix.asset_name }}.sha256
cat ${{ matrix.asset_name }}.sha256
- name: Upload binary
uses: softprops/action-gh-release@v1
with:
files: |
target/${{ matrix.target }}/release/${{ matrix.asset_name }}
target/${{ matrix.target }}/release/${{ matrix.asset_name }}.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}