-
Notifications
You must be signed in to change notification settings - Fork 13
191 lines (169 loc) · 6.51 KB
/
Copy pathrelease.yml
File metadata and controls
191 lines (169 loc) · 6.51 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
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: Release
on:
push:
tags:
- "v*.*.*"
- "v*.*.*.rc-*"
workflow_dispatch:
inputs:
tag:
description: 'Tag to build (e.g. v0.1.2)'
required: true
jobs:
build:
name: Build ${{ matrix.target }} (${{ matrix.runner }})
runs-on: ${{ matrix.os }}
permissions:
contents: read
id-token: write
attestations: write
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
RUST_LOG: debug
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
archive: linux-x86_64.tar.gz
attestation: linux-x86_64.attestation.txt
elementsd_target: "x86_64-linux-gnu"
electrs_target: "linux"
nextest_target: "x86_64-unknown-linux-gnu"
- target: aarch64-apple-darwin
os: macos-latest
archive: darwin-arm64.tar.gz
attestation: darwin-arm64.attestation.txt
elementsd_target: "arm64-apple-darwin"
electrs_target: "macos"
nextest_target: "universal-apple-darwin"
steps:
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
ref: ${{ github.event.inputs.tag || github.ref }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Use Rust cache
uses: Swatinem/rust-cache@v2
- name: Build binaries
env:
RUST_PROFILE: release
TARGET: ${{ matrix.target }}
OUT_DIR: target/${{ matrix.target }}
run: |
cargo build --target $TARGET --profile $RUST_PROFILE --bins
mv $OUT_DIR/${{ env.RUST_PROFILE }}/simplex simplex
- name: Download nextest, elementsd and electrs
env:
NEXTEST_VERSION: "0.9.137"
ELEMENTSD_VERSION: "23.3.1"
ELEMENTSD_TARGET: ${{ matrix.elementsd_target }}
ELECTRS_TARGET: ${{ matrix.electrs_target }}
NEXTEST_TARGET: ${{ matrix.nextest_target }}
run: |
ELEMENTSD_FILENAME="elements-${ELEMENTSD_VERSION}-${ELEMENTSD_TARGET}.tar.gz"
ELECTRS_FILENAME="electrs_${ELECTRS_TARGET}_esplora_027e38d3ebc2f85b28ae76f8f3448438ee4fc7b1_liquid.zip"
NEXTEST_FILENAME="cargo-nextest-${NEXTEST_VERSION}-${NEXTEST_TARGET}.tar.gz"
curl -Ls "https://github.com/ElementsProject/elements/releases/download/elements-${ELEMENTSD_VERSION}/${ELEMENTSD_FILENAME}" -o ${ELEMENTSD_FILENAME}
tar -xzf ${ELEMENTSD_FILENAME} && rm ${ELEMENTSD_FILENAME}
mv elements-${ELEMENTSD_VERSION}/bin/elementsd elementsd
rm -rf elements-${ELEMENTSD_VERSION}
curl -Ls "https://github.com/RCasatta/electrsd/releases/download/electrs_releases/${ELECTRS_FILENAME}" -o ${ELECTRS_FILENAME}
unzip ${ELECTRS_FILENAME} && rm ${ELECTRS_FILENAME}
curl -Ls "https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-${NEXTEST_VERSION}/${NEXTEST_FILENAME}" -o ${NEXTEST_FILENAME}
tar -xzf ${NEXTEST_FILENAME} && rm ${NEXTEST_FILENAME}
mv cargo-nextest smplx-nextest
- name: Sign elementsd binary
run: |
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then
codesign --force -s - elementsd
fi
- name: Binaries attestation
id: attestation
uses: actions/attest-build-provenance@v4
with:
subject-path: |
simplex
elementsd
electrs
smplx-nextest
- name: Record attestation URL
env:
ATTESTATION: simplex-${{ github.event.inputs.tag || github.ref_name }}-${{ matrix.attestation }}
ATESTATION_URL: ${{ steps.attestation.outputs.attestation-url }}
run: printf '%s\n' ${ATESTATION_URL} > ${ATTESTATION}
- name: Archive binaries
env:
ARCHIVE: simplex-${{ github.event.inputs.tag || github.ref_name }}-${{ matrix.archive }}
run: tar czf ${ARCHIVE} simplex elementsd electrs smplx-nextest
- name: Upload build artifacts
uses: actions/upload-artifact@v6
with:
name: simplex-${{ github.event.inputs.tag || github.ref_name }}-${{ matrix.archive }}
path: |
simplex-${{ github.event.inputs.tag || github.ref_name }}-${{ matrix.attestation }}
simplex-${{ github.event.inputs.tag || github.ref_name }}-${{ matrix.archive }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v6
with:
merge-multiple: true
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.ARVOLEAR_TOKEN }}
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
name: Simplex ${{ github.event.inputs.tag || github.ref_name }}
prerelease: false
body: |
# Release notes ${{ github.event.inputs.tag || github.ref_name }} 🎉
TBD
files: |
simplex-${{ github.event.inputs.tag || github.ref_name }}-linux-x86_64.attestation.txt
simplex-${{ github.event.inputs.tag || github.ref_name }}-linux-x86_64.tar.gz
simplex-${{ github.event.inputs.tag || github.ref_name }}-darwin-arm64.attestation.txt
simplex-${{ github.event.inputs.tag || github.ref_name }}-darwin-arm64.tar.gz
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
needs: [ build, release ]
permissions:
contents: read
id-token: write
concurrency:
group: publish-core-${{ github.ref }}
cancel-in-progress: false
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Authenticate
uses: rust-lang/crates-io-auth-action@v1
id: auth
- name: Publish
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
run: |
./scripts/publish \
./crates/sdk/Cargo.toml \
./crates/build/Cargo.toml \
./crates/regtest/Cargo.toml \
./crates/test/Cargo.toml \
./crates/macros/Cargo.toml \
./crates/simplex/Cargo.toml