-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (79 loc) · 2.44 KB
/
anchor.yml
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
name: Publish a release
on:
push:
tags:
- "anchor*"
permissions:
contents: write
env:
CROSS_VERSION: 0.2.5
jobs:
release-linux:
name: Release (Linux)
strategy:
matrix:
include:
- target: aarch64-apple-darwin
os: macos-latest
cross-rs: false
suffix: macos-arm64
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
cross-rs: true
suffix: linux-arm64
- target: x86_64-apple-darwin
os: macos-latest
cross-rs: false
suffix: macos-amd64
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
cross-rs: true
suffix: linux-amd64
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract_version.outputs.version }}
steps:
- name: Extract version from tag
id: extract_version
run: |
echo "version=$(echo ${GITHUB_REF#refs/tags/anchor-})" >> $GITHUB_OUTPUT
- name: Checkout code
uses: actions/checkout@v2
with:
repository: coral-xyz/anchor
ref: ${{ steps.extract_version.outputs.version }}
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- name: Install cross
if: matrix.cross-rs == true
uses: supplypike/setup-bin@v3
with:
uri: "https://github.com/cross-rs/cross/releases/download/v${{ env.CROSS_VERSION }}/cross-x86_64-unknown-linux-musl.tar.gz"
name: "cross"
version: "${{ env.CROSS_VERSION }}"
- name: Install target toolchain
if: matrix.cross-rs == false
run: |
rustup target add ${{ matrix.target }}
- name: Build
if: matrix.cross-rs == true
run: |
cross build --release --target ${{ matrix.target }}
- name: Build
if: matrix.cross-rs == false
run: |
cargo build --release --target ${{ matrix.target }}
- name: Copy binary
run: |
cp target/${{ matrix.target }}/release/anchor anchor-${{ matrix.suffix }}
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.PAT_TOKEN }}
files: |
light-anchor-${{ matrix.suffix }}