-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (80 loc) · 2.32 KB
/
release.yml
File metadata and controls
84 lines (80 loc) · 2.32 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build-binaries:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
ext: ""
archive: tar.gz
- os: windows-latest
target: x86_64-pc-windows-msvc
ext: ".exe"
archive: zip
- os: macos-14
target: x86_64-apple-darwin
ext: ""
archive: tar.gz
- os: macos-14
target: aarch64-apple-darwin
ext: ""
archive: tar.gz
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: cargo build
run: cargo build --release --target ${{ matrix.target }}
- name: package
shell: bash
run: |
set -euo pipefail
bin="cipherscope${{ matrix.ext }}"
src="target/${{ matrix.target }}/release/${bin}"
dist="dist"
mkdir -p "${dist}"
if [[ "${{ matrix.archive }}" == "zip" ]]; then
7z a "${dist}/cipherscope-${{ github.ref_name }}-${{ matrix.target }}.zip" "${src}"
else
tar -czf "${dist}/cipherscope-${{ github.ref_name }}-${{ matrix.target }}.tar.gz" -C "target/${{ matrix.target }}/release" "${bin}"
fi
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: cipherscope-${{ matrix.target }}
path: dist/*
if-no-files-found: error
publish:
needs: build-binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: cargo test
run: cargo test
- name: cargo publish
run: cargo publish --allow-dirty
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: download artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
dist/**/*.tar.gz
dist/**/*.zip