-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (69 loc) · 2.16 KB
/
Copy pathrelease.yml
File metadata and controls
74 lines (69 loc) · 2.16 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
# Publish amendable binaries to GitHub Releases when an x.y.z tag is pushed.
# Set Cargo.toml version, commit on master, then: git tag X.Y.Z && git push origin X.Y.Z
name: Release
permissions:
contents: read
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-*'
pull_request:
paths:
- .github/workflows/release.yml
env:
CARGO_INCREMENTAL: "0"
CARGO_TERM_COLOR: always
jobs:
create-release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Check Cargo.toml version matches tag
run: |
set -euo pipefail
tag="${GITHUB_REF_NAME}"
cargo_version="$(awk -F '"' '/^\[package\]/{p=1} p&&/^version =/{print $2; exit}' Cargo.toml)"
if [ "$tag" != "$cargo_version" ]; then
echo "Tag ${tag} does not match Cargo.toml version ${cargo_version}" >&2
exit 1
fi
- uses: taiki-e/create-gh-release-action@v1
with:
branch: master
upload-assets:
needs: create-release
if: ${{ !cancelled() && (needs.create-release.result == 'success' || needs.create-release.result == 'skipped') }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: taiki-e/upload-rust-binary-action@v1
with:
bin: amendable
target: ${{ matrix.target }}
tar: unix
zip: windows
checksum: sha256
include: LICENSE,README.md
locked: true
dry-run: ${{ github.event_name != 'push' }}
dry-run-intended: ${{ github.event_name != 'push' }}