-
Notifications
You must be signed in to change notification settings - Fork 7
120 lines (98 loc) · 3.71 KB
/
Copy pathrelease.yml
File metadata and controls
120 lines (98 loc) · 3.71 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
name: Release zombie-bite
on:
push:
tags:
- 'v*.*.*'
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
bin-suffix: "" # empty for linux x86_64
- os: macos-latest
target: aarch64-apple-darwin
bin-suffix: "-macos-arm64"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
- name: Fetch cache
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
with:
shared-key: "zombie-bite-cache"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: deps
shell: bash
run: |
if [[ "$RUNNER_OS" == "Linux" ]]; then
sudo apt-get update && sudo apt-get install -y protobuf-compiler
elif [[ "$RUNNER_OS" == "macOS" ]]; then
brew install protobuf
fi
- name: Build
run: SKIP_WASM_BUILD=1 cargo build --release --target ${{ matrix.target }}
- name: Package binary
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/zombie-bite dist/zombie-bite${{ matrix.bin-suffix }}
- name: Upload artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: zombie-bite-${{ matrix.os }}-${{ matrix.target }}-${{ github.ref_name }}
path: dist/*
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifacts
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
path: artifacts
- name: Generate checksums
run: |
cd artifacts
# move files to artifacts
mv zombie-bite-macos-latest-aarch64-apple-darwin-${{ github.ref_name }}/* .
rmdir zombie-bite-macos-latest-aarch64-apple-darwin-${{ github.ref_name }}
mv zombie-bite-ubuntu-latest-x86_64-unknown-linux-gnu-${{ github.ref_name }}/* .
rmdir zombie-bite-ubuntu-latest-x86_64-unknown-linux-gnu-${{ github.ref_name }}
sha256sum * > checksums.txt
- name: Create Release
uses: softprops/action-gh-release@6cbd405e2c4e67a21c47fa9e383d020e4e28b836 # v2.3.3
with:
files: |
artifacts/**/*
artifacts/checksums.txt
generate_release_notes: false
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
runs-on: ubuntu-latest
# crates.io uploads can't be undone, so only publish once the release is out
needs: release
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: deps
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Check the tag matches the crates version
run: |
version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "zombie-bite-core") | .version')
if [[ "v$version" != "${{ github.ref_name }}" ]]; then
echo "tag ${{ github.ref_name }} does not match crates version $version"
exit 1
fi
# commented until we move to parity-publish
# - name: Publish to crates.io
# run: SKIP_WASM_BUILD=1 cargo publish --workspace
# env:
# CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}