-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (88 loc) · 2.72 KB
/
Copy pathrelease.yml
File metadata and controls
101 lines (88 loc) · 2.72 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
name: Release Binaries
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Existing release tag to build and attach binaries to (e.g. v0.2.1)"
required: true
permissions:
contents: write
env:
BIN_NAME: chaykin
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
asset: linux-x86_64
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
asset: linux-arm64
- target: x86_64-apple-darwin
os: macos-15-intel
asset: macos-x86_64
- target: aarch64-apple-darwin
os: macos-14
asset: macos-arm64
- target: x86_64-pc-windows-msvc
os: windows-latest
ext: ".exe"
asset: windows-x86_64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build
run: cargo build --release -p chaykin --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
set -euxo pipefail
# A plain relative directory, not mktemp: on Windows, mktemp -d
# yields an MSYS-style path (e.g. /tmp/tmp.XXXX) that native tools
# like 7z.exe cannot resolve, silently zipping nothing.
STAGE="stage"
mkdir -p "$STAGE"
cp "target/${{ matrix.target }}/release/${BIN_NAME}${{ matrix.ext }}" "$STAGE/"
cp LICENSE-MIT LICENSE-APACHE README.md "$STAGE/"
TAG="${{ github.event.inputs.tag || github.ref_name }}"
ARCHIVE="${BIN_NAME}-${TAG}-${{ matrix.asset }}"
if [[ "${{ matrix.os }}" == windows-* ]]; then
(cd "$STAGE" && 7z a "../${ARCHIVE}.zip" .)
else
tar -czf "${ARCHIVE}.tar.gz" -C "$STAGE" .
fi
- uses: actions/upload-artifact@v4
with:
name: ${{ env.BIN_NAME }}-${{ matrix.asset }}
path: |
*.tar.gz
*.zip
if-no-files-found: error
attach:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Determine tag
id: tag
run: echo "tag=${{ github.event.inputs.tag || github.ref_name }}" >> "$GITHUB_OUTPUT"
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.tag }}
files: dist/*
fail_on_unmatched_files: true