-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (86 loc) · 2.91 KB
/
Copy pathrelease.yml
File metadata and controls
90 lines (86 loc) · 2.91 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: read
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dtolnay/rust-toolchain@d1031067263f94b142dd6c0ce24c5eb9d02d52a0 # master
with:
toolchain: stable
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
- name: cargo build
run: cargo build --locked --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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cipherscope-${{ matrix.target }}
path: dist/*
if-no-files-found: error
publish:
permissions:
contents: write
needs: build-binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dtolnay/rust-toolchain@d1031067263f94b142dd6c0ce24c5eb9d02d52a0 # master
with:
toolchain: stable
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
- name: cargo test
run: cargo test --locked --all-features
- name: cargo publish
run: cargo publish --locked
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: dist
- name: GitHub Release
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
with:
body_path: docs/releases/${{ github.ref_name }}.md
files: |
dist/**/*.tar.gz
dist/**/*.zip