Repository navigation
96 lines (85 loc) · 2.5 KB
/
Copy pathrelease.yml
File metadata and controls
96 lines (85 loc) · 2.5 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
name: Release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to release (semver, e.g. 0.1.0)'
required: true
type: string
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
archive: tar.gz
- target: aarch64-unknown-linux-musl
os: ubuntu-22.04-arm
archive: tar.gz
- target: x86_64-apple-darwin
os: macos-15-intel
archive: tar.gz
- target: aarch64-apple-darwin
os: macos-15
archive: tar.gz
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@1.99.1
with:
targets: ${{ matrix.target }}
- name: Install musl tools (Linux)
if: contains(matrix.target, 'linux-musl')
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-
- name: Build binary
run: cargo build --release --target ${{ matrix.target }}
- name: Create archive
shell: bash
run: |
mkdir -p dist
BIN_DIR="target/${{ matrix.target }}/release"
ARCHIVE="synx-${{ inputs.tag || github.ref_name }}-${{ matrix.target }}.tar.gz"
tar czf "dist/${ARCHIVE}" -C "${BIN_DIR}" synx
ls -la dist/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.target }}
path: dist/*
if-no-files-found: error
publish-crate:
name: Publish to Crates.io
needs: build
uses: muvon/ci-workflow/.github/workflows/rust-publish.yml@master
secrets: inherit
with:
tag: ${{ inputs.tag }}
release:
name: Create Release
needs: [build, publish-crate]
uses: muvon/ci-workflow/.github/workflows/release.yml@master
with:
tag: ${{ inputs.tag }}
artifacts: 'release-*'
draft: false