-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (84 loc) · 2.46 KB
/
release.yaml
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
name: Release
on:
push:
tags:
- '*'
jobs:
create-release:
name: Create release
permissions:
contents: write
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
comix_version: ${{ env.COMIX_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get the release version
shell: bash
if: env.COMIX_VERSION == ''
run: |
echo "COMIX_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "COMIX version is: ${{ env.COMIX_VERSION }}"
- name: Generate a changelog
id: changelog
uses: orhun/git-cliff-action@v3
with:
config: cliff.toml
args: --latest --strip header
env:
OUTPUT: CHANGELOG.md
- name: Release
id: release
uses: softprops/action-gh-release@v2
with:
body_path: CHANGELOG.md
build-release:
name: Build release assets
needs: [create-release]
permissions:
contents: write
runs-on: ${{ matrix.os }}
env:
RUST_BACKTRACE: 1
strategy:
matrix:
build: [macos, macos-arm]
include:
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
- build: macos-arm
os: macos-latest
rust: stable
target: aarch64-apple-darwin
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
- name: Build package
run: cargo build --release --target ${{ matrix.target }}
- name: Build archive
shell: bash
run: |
STAGING="comix-${{ needs.create-release.outputs.comix_version }}-${{ matrix.target }}"
mkdir -p "${STAGING}"
cp README.md "${STAGING}/"
cp "target/${{ matrix.target }}/release/comix" "${STAGING}/"
tar czf "${STAGING}.tar.gz" "${STAGING}"
echo "ASSET=${STAGING}.tar.gz" >> $GITHUB_ENV
- name: Upload release archive
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.ASSET }}
asset_name: ${{ env.ASSET }}
tag: ${{ needs.create-release.outputs.comix_version }}