-
Notifications
You must be signed in to change notification settings - Fork 81
121 lines (103 loc) · 3.41 KB
/
release.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
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
name: Release binaries
on:
workflow_call:
inputs:
tag:
type: string
description: 'The tag to use for the Docker image.'
required: true
workflow_dispatch:
inputs:
prerelease_name:
description: "Suffix to use for manual pre-release."
required: false
type: string
default: ""
pull_request:
jobs:
build:
name: Build binaries
strategy:
matrix:
include:
- arch: x86_64-unknown-linux-gnu
platform: ubuntu-24.04
- arch: aarch64-unknown-linux-gnu
platform: ubuntu-24.04
- arch: x86_64-apple-darwin
platform: macos-latest
- arch: aarch64-apple-darwin
platform: macos-latest
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || '' }}
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
rustflags: ""
- name: Install target
run: rustup target add ${{ matrix.arch }}
- name: Install cross v0.2.5 from source
run: cargo install cross --git https://github.com/cross-rs/cross --tag v0.2.5
- name: Build anvil-zksync for ${{ matrix.arch }}
run: |
[[ "${{ matrix.arch }}" == *"linux"* ]] && make build-static-${{ matrix.arch }} || make build-${{ matrix.arch }}
- name: Pack anvil-zksync
run: |
tar -czf anvil-zksync-${{ inputs.tag || 'v0.0.0' }}-${{ matrix.arch }}.tar.gz \
./target/${{ matrix.arch }}/release/anvil-zksync
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: anvil-zksync-${{ matrix.arch }}
path: |
anvil-zksync-${{ inputs.tag || 'v0.0.0' }}-${{ matrix.arch }}.tar.gz
./target/${{ matrix.arch }}/release/anvil-zksync
upload-binaries:
name: Upload binaries
permissions:
contents: write
pull-requests: write
id-token: write
attestations: write
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || '' }}
- name: Define release name
id: release_tag
shell: 'bash -ex {0}'
run: |
[ ! -z "${{ inputs.tag }}" ] && TAG="${{ inputs.tag }}" \
|| TAG="$(git rev-parse --short HEAD)"
echo "tag=${TAG}" >> "${GITHUB_OUTPUT}"
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: "anvil-zksync-*"
path: artifacts
- name: Binaries attestation
uses: actions/attest-build-provenance@v2
with:
subject-path: 'artifacts/**/anvil-zksync'
- name: Update release-please release artifacts
if: ${{ inputs.tag != '' }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.tag }}
files: 'artifacts/**/anvil-zksync*.tar.gz'
- name: Create release
if: ${{ inputs.tag == '' }}
uses: softprops/action-gh-release@v2
with:
name: 'anvil-zksync ${{ inputs.prerelease_name}} ${{ steps.release_tag.outputs.tag }}'
tag_name: ${{ steps.release_tag.outputs.tag }}
prerelease: true
files: 'artifacts/**/anvil-zksync*.tar.gz'