-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (118 loc) · 3.53 KB
/
release.yaml
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: release
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
push:
branches:
- trunk
tags:
- "*"
workflow_dispatch:
defaults:
run:
shell: bash
env:
name: row
CARGO_TERM_COLOR: always
CLICOLOR: 1
RUST_VERSION: 1.78.0
jobs:
source:
name: Build source tarball
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
path: code
- name: Determine filename-safe ref from GITHUB_REF_NAME
run: echo ref="$(echo "${GITHUB_REF_NAME}" | sed -e 's/\//-/g')" >> "$GITHUB_ENV"
- name: Copy source
run: cp -R code "${name}-${ref}"
- name: Remove .git
run: rm -rf "${name}-${ref}/.git" && ls -laR "${name}-${ref}"
- name: Tar/xz source
run: tar -cvJf "${name}-${ref}.tar.xz" "${name}-${ref}"
- uses: actions/[email protected]
with:
name: source
path: |
*.tar.*
release-notes:
name: Extract release notes
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
path: code
- name: Write release-notes.md
run: grep -P -m 2 -B 10000 "^## v*\d*\.\d*\.\d*" doc/src/release-notes.md | sed '$d' | tee "${GITHUB_WORKSPACE}/release-notes.md"
working-directory: code
- uses: actions/[email protected]
with:
name: release-notes
path: |
release-notes.md
binary:
name: Build [${{ matrix.target }}]
runs-on: ${{ matrix.runner }}
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
# - aarch64-apple-darwin
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-20.04
# - target: aarch64-apple-darwin
# runner: macos-14
steps:
- uses: actions/[email protected]
- name: Determine filename-safe ref from GITHUB_REF_NAME
run: echo ref="$(echo "${GITHUB_REF_NAME}" | sed -e 's/\//-/g')" >> "$GITHUB_ENV"
- name: Update rust
run: rustup install "$RUST_VERSION" --no-self-update && rustup default "$RUST_VERSION"
- name: Check rust installation
run: rustc -vV
- uses: actions/[email protected]
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-rust-${{ env.RUST_VERSION }}-cargo-release-binary-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --locked --bin "${name}" --release --target ${{ matrix.target }}
- name: Check output
run: file "target/${{ matrix.target }}/release/${name}"
- name: Compress
run: cp "target/${{ matrix.target }}/release/${name}" . && tar -cvJf "${name}-${ref}-${{ matrix.target }}.tar.xz" "${name}"
- uses: actions/[email protected]
with:
name: ${{ matrix.target }}
path: "${{ env.name }}-${{ env.ref }}-${{ matrix.target }}.tar.xz"
publish:
name: Publish [GitHub]
needs: [binary, source, release-notes]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/[email protected]
with:
merge-multiple: true
- name: List files
run: ls -lR
- name: Create release
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/v')
with:
files: |
*.xz
body_path: release-notes.md
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}